uv icon indicating copy to clipboard operation
uv copied to clipboard

uv add with multiple (extra-)index-urls fails

Open legout opened this issue 1 year ago • 3 comments

Hi guys,

we have multiple private gitlab repos with its own package index.

When I try to add two packages to my project, I always get an error, that a package can not be downloaded.

I´ve tried the following:

Add [[tool.uv.index]] entries to the pyproject.toml for each package (with and without additional [tool.uv.sources])


[tool.uv.sources]
package1 = { index = "package1" }
package2 = { index = "package2" }

[[tool.uv.index]]
name = "package1"
url = "https://token1:[email protected]/api/v4/projects/12345/packages/pypi/simple"

[[tool.uv.index]]
name = "package2"
url = "https://token1:[email protected]/api/v4/projects/12345/packages/pypi/simple"

Set the env variable UV_EXTRA_INDEX_URL to https://token1:[email protected]/api/v4/projects/12345/packages/pypi/simple https://token1:[email protected]/api/v4/projects/12345/packages/pypi/simple (space seperated both package registries)

Run each add command with its own --index

uv add package1 --index https://token1:[email protected]/api/v4/projects/12345/packages/pypi/simple
uv add package2 --index https://token1:[email protected]/api/v4/projects/12345/packages/pypi/simple

None of these worked. It alway fails to download one of the packages.

error: Failed to fetch: `https://private.gitlab-repo.com/api/v4/projects/12345/packages/pypi/files/5558649d00d348f5f9486dcd7d309cfa9968f06cd0f40bf01fa06e4c758e67ef/package1-0.1.0-py3-none-any.whl#sha256=5558649d00d348f5f9486dcd7d309cfa9968f06cd0f40bf01fa06e4c758e67ef`
  Caused by: HTTP status client error (404 Not Found) for url (https://private.gitlab-repo.com/api/v4/projects/12345/packages/pypi/files/5558649d00d348f5f9486dcd7d309cfa9968f06cd0f40bf01fa06e4c758e67ef/package1-0.1.0-py3-none-any.whl#sha256=5558649d00d348f5f9486dcd7d309cfa9968f06cd0f40bf01fa06e4c758e67ef)

legout avatar Dec 09 '24 16:12 legout

xref https://discord.com/channels/1039017663004942429/1314574704866099300/1314574704866099300

zanieb avatar Dec 09 '24 19:12 zanieb

This sounds very familiar, is this the same as my issue in #8565 ?

hbeukers avatar Dec 09 '24 22:12 hbeukers

This is how i got it working.

  • Removed the [tool.uv.sources] from the pyproject.toml
  • Run uv lock before uv sync or uv add.

legout avatar Dec 10 '24 09:12 legout

Hi guys,

unfortunately, this issue isn´t solved for me yet. uv lock solves the problem sometimes. Unfortunately, it is completly unpredictable when and how this works.

@zanieb Can you please reopen this issue?

legout avatar Feb 06 '25 07:02 legout

@legout this seems like it should be fixed by #11074

zanieb avatar Feb 08 '25 02:02 zanieb

Can you share a clear reproduction on the latest version?

zanieb avatar Feb 08 '25 02:02 zanieb

@zanieb I´ve updated uv and it seems to work now. Thanks a lot!

legout avatar Feb 10 '25 11:02 legout