Curator icon indicating copy to clipboard operation
Curator copied to clipboard

Curator pip install (Main, Epic): Installing all optional dependencies together results in dependency conflict

Open pablo-garay opened this issue 11 months ago • 8 comments

Describe the bug

The Install Check test found a real dependency conflict:

nemo-toolkit[asr] 2.4.0 → transformers>=4.51.0,<=4.52.0 vllm 0.11.0 → transformers>=4.55.2

These ranges don't overlap: 4.52.0 < 4.55.2 UV Works but Pip Fails

In pyproject.toml, you have: [tool.uv] override-dependencies = [ "transformers>=4.55.2", # This forces a specific version ]

UV uses these overrides to force a resolution. Pip doesn't have this feature - it fails when it can't find a compatible version.

Steps/Code to reproduce bug

Try pip installing all optional dependencies e.g. pip install .[all]

Expected behavior

Installing all optional dependencies together should work and not have conflicts

pablo-garay avatar Dec 17 '25 16:12 pablo-garay

@pablo-garay Whenever you get a chance, can you see if there are new versions of nemo-toolkit[asr] and its restrictions on transformers. Also which dependency group is vllm apart of.

Add in the Describe the bug which dependency groups are conflicting.

thomasdhc avatar Dec 17 '25 17:12 thomasdhc

Just some further info: Pipeline: https://github.com/NVIDIA-NeMo/Curator/actions/runs/20317535825/job/58365113886?pr=1303

============================================== 📊 ALL EXTRAS (uv, Py3.12) - Install + Import

❌ Install: FAILED (expected - known conflicts)

Known conflicts:

  • nemo_toolkit[asr] requires transformers<4.55
  • vllm requires transformers>=4.55

pablo-garay avatar Dec 17 '25 21:12 pablo-garay

This is a real dependency conflict that the install test correctly caught: cuda-toolkit[nvcc,nvrtc] 12.9.1 → nvidia-cuda-nvrtc-cu12==12.9.86.*torch 2.9.1 → nvidia-cuda-nvrtc-cu12==12. These versions don't match, and pip can't resolve it (UV handles this via override-dependencies in pyproject.toml, but pip doesn't have that feature).

Logs: https://github.com/NVIDIA-NeMo/Curator/actions/runs/20317535825/job/58365113901?pr=1303

pablo-garay avatar Dec 17 '25 21:12 pablo-garay

Another job logs: https://github.com/NVIDIA-NeMo/Curator/actions/runs/20325311751/job/58389351222?pr=1303

ModuleNotFoundError: No module named 'torch'

The error is caused by flash_attn-2.8.3. When pip tries to build flash_attn from source, its setup.py imports torch at build time. But pip installs packages in a specific order and torch hasn't been installed yet when it tries to build flash_attn. This is a known issue with flash-attn - it requires torch to be installed BEFORE building. With pip, the dependency resolution doesn't guarantee the order, so it can try to build flash_attn before torch is installed.

This is exactly why the pip job for GPU extras is marked as OPTIONAL - pip has trouble with these kinds of build-time dependencies. uv handles this better because it can use pre-built wheels or handles the dependency order better. This is not a problem with our workflow - it's a known limitation of pip with packages like flash_attn that have build-time dependencies on torch.

The error is from flash_attn-2.8.3:

Downloading flash_attn-2.8.3.tar.gz (8.4 MB)Installing build dependencies: finished with status 'done'Getting requirements to build wheel: finished with status 'error'

ModuleNotFoundError: No module named 'torch'

Root Cause: flash-attn requires torch to be installed before it can even be built. Its setup.py imports torch at line 22 during the build process. But pip's dependency resolution doesn't guarantee installation order, so it tries to build flash_attn before torch is installed.

Why uv works: uv either:

  1. Uses pre-built wheels (no build needed)
  2. Better handles build-time dependencies

This is expected behavior - it's exactly why the GPU pip job is marked OPTIONAL. This is a known limitation of pip with packages like flash-attn, xformers, etc. that have CUDA/torch build-time dependencies.

The workflow is working correctly

pablo-garay avatar Dec 18 '25 06:12 pablo-garay

  1. OPTIONAL: GPU Extras Individual - Install Only (pip) - Py3.12 Results from CI: ExtraStatuscuda12:white_check_mark: deduplication_cuda12:x: audio_cuda12:white_check_mark: image_cuda12:x: text_cuda12:x: video_cuda12:x:

Root cause: flash-attn build fails because: Its setup.py imports torch at build time Pip installs dependencies in parallel/arbitrary order, so torch isn't available when flash-attn tries to build Error: ModuleNotFoundError: No module named 'torch'

2 & 3. OPTIONAL: ALL Extras - Install Only (pip) - Py3.12 / Py3.10 Root causes: Transformers version conflict: nemo_toolkit[asr] requires transformers<4.55 vllm requires transformers>=4.55 These are mutually exclusive - pip can't resolve this flash-attn build issues: Requires packaging module at build time Requires torch pre-installed at build time

Why uv works but pip doesn't uv uses a lockfile (uv.lock) that: Pre-resolves all dependencies Uses override-dependencies in pyproject.toml to force transformers>=4.55.2 Has no-build-isolation-package = ["flash-attn"] so torch is available during build pip doesn't have these mechanisms - it tries to resolve on-the-fly and can't handle build-time dependencies or forced overrides.

pablo-garay avatar Dec 18 '25 19:12 pablo-garay

Summary of issues: Current status (to be fixed):

Job - Why it fails with pip OPTIONAL: GPU Extras (pip) flash-attn build requires torch pre-installed (pip can't handle build-time deps) OPTIONAL: ALL Extras (pip) Py3.12 nemo_toolkit[asr] needs transformers<4.55 but vllm needs >=4.55 flash-attn needs torch at build time OPTIONAL: ALL Extras (pip) Py3.10 Same transformers conflict + flash-attn build issue These pass with uv (uses lockfile + dependency overrides) but fail with pip due to pip's dependency resolution limitations. These pass with uv because pyproject.toml uses no-build-isolation-package = ["flash-attn"] which allows flash-attn to see already-installed torch. pip doesn't support this.

Image

pablo-garay avatar Dec 19 '25 23:12 pablo-garay

@thomasdhc good to close this now?

arhamm1 avatar May 28 '26 19:05 arhamm1

Closing as addressed — the resolution here was to document the limitation rather than make pip install ".[all]" work.

  • Install guide now states pip is not supported for all extras together and recommends uv or the container: https://docs.nvidia.com/nemo/curator/latest/get-started/installation
  • CI validates individual extras and uv sync --extra all (install + import); pip [all] was intentionally removed from required tests in #1338

Per-modality pip installs (e.g. pip install nemo-curator[text_cpu]) remain supported. Feel free to reopen if we want to officially pursue full pip [all] support as a feature request.

lbliii avatar Jun 22 '26 16:06 lbliii