astral-sh / uv

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

[BUG] can not use private pypi repo to install package(same as offical pypi package) #9008

Open Sube-py opened 2 days ago

Sube-py commented 2 days ago
uv add utensils --extra-index-url https://user:password@100.64.0.1:8000/simple --allow-insecure-host=100.64.0.1                                                                                                                 
warning: Indexes specified via `--extra-index-url` will not be persisted to the `pyproject.toml` file; use `--index` instead.
  × No solution found when resolving dependencies:
  ╰─▶ Because there are no versions of utensils and your project depends on utensils, we can conclude that your project's requirements are unsatisfiable.

      hint: `utensils` was found on https://user:password@100.64.0.1:8000/simple, but not at the requested version (all versions of utensils). A compatible version may be available on a subsequent index (e.g., https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple).
      By default, uv will only consider versions that are published on the first index that contains a given package, to avoid dependency confusion attacks. If all indexes are equally trusted, use `--index-strategy unsafe-best-match` to consider all versions from all
      indexes, regardless of the order in which they were defined.
  help: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing.

The package name in the private repository is the same as in the official source, which makes it impossible for me to specify the package to install in the private repository.

charliermarsh commented 2 days ago

Sorry, are you trying to install utensils from https://user:password@100.64.0.1:8000/simple or from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple?

Sube-py commented 1 day ago

Sorry, are you trying to install utensils from https://user:password@100.64.0.1:8000/simple or from https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple?

from my private repo(https://user:password@100.64.0.1:8000/simple), I tried three strategies(first match, unsafe...), but not working, it still install it from index-url(https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple).

charliermarsh commented 1 day ago

Can you include the full logs with --verbose? I'm not sure how to help, by default uv will always choose the version in your private repo if it exists. It must be failing to use your registry due to some misconfiguration.