Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package dependencies not installed on first uv run --extra with conflicting extras #9622

Closed
eginhard opened this issue Dec 3, 2024 · 1 comment · Fixed by #9370
Closed
Labels
bug Something isn't working

Comments

@eginhard
Copy link

eginhard commented Dec 3, 2024

I can confirm that #9533 is fixed with uv 0.5.6, this is a follow-up for packages with dependencies in conflicting extras:

[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.10.0"
dependencies = []

[project.optional-dependencies]
cpu = ["torch>=2.0"]
cu118 = ["torch>=2.0"]

[tool.uv]
conflicts = [
  [
    { extra = "cpu" },
    { extra = "cu118" },
  ],
]

[tool.uv.sources]
torch = [
  { index = "pytorch-cpu", extra = "cpu", marker = "platform_system != 'Darwin'" },
  { index = "pytorch-cu118", extra = "cu118" },
]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[[tool.uv.index]]
name = "pytorch-cu118"
url = "https://download.pytorch.org/whl/cu118"
explicit = true

To reproduce:

  1. Ensure lock file and venv are not present:
rm .venv/ uv.lock -rdf
  1. On the first run only torch itself is installed:
$ uv run --extra cpu python -c "import torch; print(torch.__version__)"
Using CPython 3.13.0
Creating virtual environment at: .venv
Installed 1 package in 88ms
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import torch; print(torch.__version__)
    ^^^^^^^^^^^^
  File ".../.venv/lib/python3.13/site-packages/torch/__init__.py", line 37, in <module>
    from typing_extensions import ParamSpec as _ParamSpec, TypeGuard as _TypeGuard
ModuleNotFoundError: No module named 'typing_extensions'
  1. The dependencies only get installed on the second run:
$ uv run --extra cpu python -c "import torch; print(torch.__version__)"
Installed 9 packages in 16ms
2.5.1+cpu
@charliermarsh
Copy link
Member

Should be fixed soon, sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants