fix(pip): split diarize deps to avoid resolution-too-deep on Linux

- requirements.txt: drop pyannote/huggingface_hub (kept in diarize file)
- requirements-diarize.txt: pin torch 2.5.1, torchaudio, lightning 2.4.0, pyannote.audio 3.3.2
- environment.yml: install both requirement files
- README: two-step install, update options and platform table

Made-with: Cursor
This commit is contained in:
dosangyoon
2026-03-23 16:03:26 +09:00
parent 5edd0b32e7
commit 49c2e4a5a7
4 changed files with 28 additions and 20 deletions

View File

@@ -72,18 +72,13 @@ brew install ffmpeg
```bash ```bash
conda create -n stt python=3.11 -y conda create -n stt python=3.11 -y
conda activate stt conda activate stt
pip install -U pip setuptools wheel
pip install -r requirements.txt pip install -r requirements.txt
pip install -r requirements-diarize.txt
``` ```
**`resolution-too-deep` (pip이 의존성 그래프를 너무 깊게 탐색하다 실패)** **Linux에서 `pip install -r requirements.txt` 만으로 `resolution-too-deep` 이 난 경우**
최신 `pyannote.audio` 4.x 쪽은 `torch`·OpenTelemetry 등 하위 의존이 많아 한 번에 설치할 때 자주 납니다. 이 저장소 `requirements.txt` **화자 분리용으로 `pyannote.audio==3.3.2`·`torch==2.5.1`·`lightning<2.5`** 등을 고정해 그래프를 줄여 둡니다. 그래도 실패하면 `pip install -U "pip>=24"` 후 재시도하거나, conda로 torch 먼저 올린 뒤 같은 env에서 `pip install -r requirements.txt` 하세요 (`conda install pytorch torchaudio cpuonly -c pytorch -y`). 예전에는 `pyannote.audio>=3.1.0` 이 한 파일에 있어 최신 버전까지 풀며 그래프가 깊어질 수 있었습니다. 지금은 **베이스**(`requirements.txt`)와 **화자 분리**(`requirements-diarize.txt`, `torch`·`pyannote.audio==3.3.2` 고정)로 나뉘어 있습니다. 위처럼 **두 파일을 순서대로** 설치하고, 그래도 실패하면 **conda로 PyTorch 먼저** 한 뒤 `pip install -r requirements-diarize.txt` 만 다시 시도해 보세요 (`requirements-whisper-stt.txt` 절의 torch 복구 절차 참고).
**CPU 전용 PyTorch 휠만 쓰고 싶을 때** (CUDA 번들을 피하려면):
```bash
pip install torch==2.5.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt
```
### 2) (선택) 로컬 전사 CLI — `whisper_stt.py` ### 2) (선택) 로컬 전사 CLI — `whisper_stt.py`
@@ -151,7 +146,7 @@ conda env create -f environment.yml
conda activate ncue conda activate ncue
``` ```
`pip` 의존성은 `requirements.txt`를 통해 설치됩니다. 팀에서 이미 `ncue`를 쓰는 경우에만 사용해도 됩니다. `pip` 의존성은 `requirements.txt``requirements-diarize.txt`를 통해 설치됩니다. 팀에서 이미 `ncue`를 쓰는 경우에만 사용해도 됩니다.
--- ---
@@ -196,7 +191,8 @@ uvicorn app.main:app --reload --host 127.0.0.1 --port 8025
```bash ```bash
conda activate ncue conda activate ncue
pip install "numpy>=1.26,<2.2" --force-reinstall pip install "numpy>=1.26,<2.2" --force-reinstall
pip install -r requirements.txt # 나머지 의존성 유지 pip install -r requirements.txt
pip install -r requirements-diarize.txt
./run.sh ./run.sh
``` ```
@@ -249,7 +245,7 @@ ProxyPassReverse "/stt/" "http://127.0.0.1:8025/"
- **모델**: 기본 `small` (정확도/속도 균형). `APP_WHISPER_MODEL=base|small|medium|large-v3` 등으로 변경 가능. - **모델**: 기본 `small` (정확도/속도 균형). `APP_WHISPER_MODEL=base|small|medium|large-v3` 등으로 변경 가능.
- **디바이스**: 기본 CPU. Apple Silicon에서 Metal은 `faster-whisper` 단독으로는 제한이 있어 CPU 기본값을 권장. - **디바이스**: 기본 CPU. Apple Silicon에서 Metal은 `faster-whisper` 단독으로는 제한이 있어 CPU 기본값을 권장.
- **화자 분리**: `pip install -r requirements.txt``pyannote.audio`가 포함됩니다. 모델 폴더는 `WHISPER_DIARIZE_MODEL_DIR` / `PYANNOTE_MODEL_DIR` 또는 기본 `./models/pyannote-diarization-3.1`. 다른 경로는 `APP_PYANNOTE_MODEL_DIR`로 지정 가능. HF 토큰(`HF_TOKEN` 등)과 gated 저장소 동의는 `whisper_stt.py` 절·`requirements-whisper-stt.txt` 주석과 동일합니다. - **화자 분리**: `pip install -r requirements-diarize.txt``pyannote.audio`·`torch` 등이 포함됩니다(베이스 `requirements.txt` 설치 후). 모델 폴더는 `WHISPER_DIARIZE_MODEL_DIR` / `PYANNOTE_MODEL_DIR` 또는 기본 `./models/pyannote-diarization-3.1`. 다른 경로는 `APP_PYANNOTE_MODEL_DIR`로 지정 가능. HF 토큰(`HF_TOKEN` 등)과 gated 저장소 동의는 `whisper_stt.py` 절·`requirements-whisper-stt.txt` 주석과 동일합니다.
- **기타**: `APP_WHISPER_DEVICE`, `APP_WHISPER_COMPUTE_TYPE`, 업로드 크기 등은 `app/main.py``.env` 예시를 참고. - **기타**: `APP_WHISPER_DEVICE`, `APP_WHISPER_COMPUTE_TYPE`, 업로드 크기 등은 `app/main.py``.env` 예시를 참고.
--- ---
@@ -308,5 +304,5 @@ grep -n LD_LIBRARY_PATH ~/.bashrc ~/.profile ~/.bash_profile 2>/dev/null
|------|--------|--------| |------|--------|--------|
| `ffmpeg` | `sudo apt install ffmpeg` | `brew install ffmpeg` | | `ffmpeg` | `sudo apt install ffmpeg` | `brew install ffmpeg` |
| Python | Conda `stt` 권장 | 동일 | | Python | Conda `stt` 권장 | 동일 |
| 웹 STT | `pip install -r requirements.txt` | 동일 | | 웹 STT | `pip install -r requirements.txt``pip install -r requirements-diarize.txt` | 동일 |
| `whisper_stt.py` | `pip install -r requirements-whisper-stt.txt` | 동일 | | `whisper_stt.py` | `pip install -r requirements-whisper-stt.txt` | 동일 |

View File

@@ -7,4 +7,5 @@ dependencies:
- ffmpeg - ffmpeg
- pip: - pip:
- -r requirements.txt - -r requirements.txt
- -r requirements-diarize.txt

17
requirements-diarize.txt Normal file
View File

@@ -0,0 +1,17 @@
# 웹·로컬 공통: 화자 분리(pyannote). 메인 requirements.txt 설치 후 이 파일을 설치하세요.
#
# pip install -U pip setuptools wheel
# pip install -r requirements.txt
# pip install -r requirements-diarize.txt
#
# `pyannote.audio>=3.1.0` 만 단독으로 두면 최신 메이저가 끌려와 torch/lightning/opentelemetry
# 등으로 pip 해석 깊이가 커져 Linux에서 resolution-too-deep 이 날 수 있습니다.
# 여기서는 pyannote 3.3.x + torch를 고정합니다 (PyPI 메타: torch>=2.0.0).
#
# CPU Linux: PyTorch 공식 CPU 인덱스
--extra-index-url https://download.pytorch.org/whl/cpu
torch==2.5.1
torchaudio==2.5.1
lightning==2.4.0
huggingface_hub>=0.26.0,<0.36.0
pyannote.audio==3.3.2

View File

@@ -8,10 +8,4 @@ faster-whisper
imageio-ffmpeg imageio-ffmpeg
psycopg[binary] psycopg[binary]
python-dotenv python-dotenv
# 화자 분리: 버전을 고정하지 않으면 pyannote 4.x + torch>=2.8 + opentelemetry 등으로 # 화자 분리(pyannote·HF 허브): requirements-diarize.txt 를 추가로 설치 (torch 고정, pip resolution-too-deep 방지)
# 의존 그래프가 커져 pip가 «resolution-too-deep» 으로 실패하는 경우가 많습니다.
huggingface_hub>=0.26.0,<0.29.0
torch==2.5.1
torchaudio==2.5.1
lightning>=2.4.0,<2.5.0
pyannote.audio==3.3.2