astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
25.38k stars 738 forks source link

cannot install packages from gemfury private repos #2024

Closed ellisonleao closed 8 months ago

ellisonleao commented 8 months ago

I've checked other issues with a similar problem but I couldn't see any fixes for that, so sorry if this is already fixed or not. I am basically trying to install some private packages using gemfury private URL as extra index URL. Right now I am getting the following error

$ ❯ uv pip install my-private-lib --extra-index-url=$PIP_EXTRA_INDEX_URL -v
 uv::requirements::from_source source=my-private-lib
    0.010306s DEBUG uv_interpreter::virtual_env Found a virtualenv named .venv at: /home/ellison/code/test-uv/.venv
    0.010472s DEBUG uv_interpreter::interpreter Cached interpreter info for Python 3.11.7, skipping probing: /home/ellison/code/test-uv/.venv/bin/python
    0.010498s DEBUG uv::commands::pip_install Using Python 3.11.7 environment at /home/ellison/code/test-uv/.venv/bin/python
    0.011815s DEBUG uv_client::registry_client Using registry request timeout of 300s
 uv_client::flat_index::from_entries
 uv_resolver::resolver::solve
      0.014597s   0ms DEBUG uv_resolver::resolver Solving with target Python version 3.11.7
   uv_resolver::resolver::choose_version package=root
   uv_resolver::resolver::get_dependencies package=root, version=0a0.dev0
        0.014692s   0ms DEBUG uv_resolver::resolver Adding direct dependency: my-private-lib*
   uv_resolver::resolver::choose_version package=my-private-lib
     uv_resolver::resolver::package_wait package_name=my-private-lib
 uv_resolver::resolver::process_request request=Versions my-private-lib
   uv_client::registry_client::simple_api package=my-private-lib
     uv_client::cached_client::get_cacheable
       uv_client::cached_client::read_and_parse_cache file=/home/ellison/.cache/uv/simple-v3/pypi/my-private-lib.rkyv
 uv_resolver::resolver::process_request request=Prefetch my-private-lib *
 uv_client::cached_client::from_path_sync path="/home/ellison/.cache/uv/simple-v3/pypi/my-private-lib.rkyv"
          0.015655s   0ms DEBUG uv_client::cached_client No cache entry for: https://pypi.org/simple/my-private-lib/
       uv_client::cached_client::fresh_request url="https://pypi.org/simple/my-private-lib/"
     uv_client::cached_client::get_cacheable
       uv_client::cached_client::read_and_parse_cache file=/home/ellison/.cache/uv/simple-v3/d736d56cadfe88a9/my-private-lib.rkyv
 uv_client::cached_client::from_path_sync path="/home/ellison/.cache/uv/simple-v3/d736d56cadfe88a9/my-private-lib.rkyv"
          0.182326s   0ms DEBUG uv_client::cached_client No cache entry for: https://repo.fury.io/loadsmart/my-private-lib/
       uv_client::cached_client::fresh_request url="https://repo.fury.io/loadsmart/my-private-lib/"
      0.646272s 631ms DEBUG uv_resolver::resolver No compatible version found for: my-private-lib
  × No solution found when resolving dependencies:
  ╰─▶ Because my-private-lib was not found in the package registry and you require celery-sqs, we can conclude that the requirements are unsatisfiable.

Also tried to setting UV_EXTRA_INDEX_URL and running the command, but I get the same error. What am I missing?

charliermarsh commented 8 months ago

Does my-private-lib exist on PyPI? I.e., is there a package with the same name on PyPI (regardless of whether it's "the same" package or an overlapping version)?

ellisonleao commented 8 months ago

Does my-private-lib exist on PyPI? I.e., is there a package with the same name on PyPI (regardless of whether it's "the same" package or an overlapping version)?

No it does not, only on gemfury

charliermarsh commented 8 months ago

Okay, I just set one of these up myself...

I assume you're passing something like --index-url https://token@repo.fury.io/username/? Can you instead try --index-url https://token@pypi.fury.io/username/? Note that I changed repo.fury.io to pypi.fury.io.

charliermarsh commented 8 months ago

It looks like Gemfury relies on the User Agent to know which "kind" of repo to serve, but uv doesn't say "pip" in its User Agent (it says uv).

Screenshot 2024-02-27 at 9 18 01 PM

ellisonleao commented 8 months ago

@charliermarsh was able to install it using --extra-index-url with pypi.fury.io as hostname. Thank you so much!

charliermarsh commented 8 months ago

Awesome, that's great to confirm!