astral-sh / uv

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

UV fails to install packages from private index hosted on jfrog artifactory #6610

Closed Mushahar closed 1 week ago

Mushahar commented 2 months ago

While running "uv pip install" with uv version 0.3.2 and Python 3.10.x, Jfrog Artifactory (v 7.68.21) returns HTTP error 500 as shown below. The same command installs the package successfully with "pip".

Given below is a log from a Windows 11 PC, but the same is reproduceable on Windows 10 and Linux (Ubuntu 20.04).

(uvtest) C:\>uv pip install -vvv -i https://<user>:<apikey>@example.com/artifactory/api/pypi/my-private-pypi-local/simple --no-deps --upgrade my-pip-pkg
    0.002163s DEBUG uv uv 0.3.2
 uv_requirements::specification::from_source source=my-pip-pkg
    0.004633s DEBUG uv_python::discovery Searching for Python interpreter in system path or `py` launcher
    0.434232s DEBUG uv_python::discovery Found `cpython-3.10.10-windows-x86_64-none` at `C:\Users\<USERNAME>\Envs\uvtest\Scripts\python.exe` (active virtual environment)
    0.434732s DEBUG uv::commands::pip::install Using Python 3.10.10 environment at C:\Users\<USERNAME>\Envs\uvtest\Scripts\python.exe
    0.435193s DEBUG uv_fs Acquired lock for `C:\Users\<USERNAME>\Envs\uvtest`
 uv_client::linehaul::linehaul
    0.455590s DEBUG uv_client::base_client Using request timeout of 30s
 uv_resolver::flat_index::from_entries
 uv_resolver::resolver::solve
    0.457196s   0ms DEBUG uv_resolver::resolver Solving with installed Python version: 3.10.10
   uv_resolver::resolver::choose_version package=root
   uv_resolver::resolver::get_dependencies_forking package=root, version=0a0.dev0
     uv_resolver::resolver::get_dependencies package=root, version=0a0.dev0
    0.457653s   0ms DEBUG uv_resolver::resolver Adding direct dependency: my-pip-pkg*
   uv_resolver::resolver::choose_version package=my-pip-pkg
 uv_resolver::resolver::process_request request=Versions my-pip-pkg
   uv_client::registry_client::simple_api package=my-pip-pkg
     uv_client::cached_client::get_cacheable
       uv_client::cached_client::read_and_parse_cache file=\\?\C:\Users\<USERNAME>\AppData\Local\uv\cache\simple-v12\index\25a5af3375425e52\my-pip-pkg.rkyv
 uv_resolver::resolver::process_request request=Prefetch my-pip-pkg *
 uv_client::cached_client::from_path_sync path="\\\\?\\C:\\Users\\<USERNAME>\\AppData\\Local\\uv\\cache\\simple-v12\\index\\25a5af3375425e52\\my-pip-pkg.rkyv"
        0.459539s   1ms DEBUG uv_client::cached_client Found stale response for: https://example.com/artifactory/api/pypi/my-private-pypi-local/simple/my-pip-pkg/
        0.459647s   1ms DEBUG uv_client::cached_client Sending revalidation request for: https://example.com/artifactory/api/pypi/my-private-pypi-local/simple/my-pip-pkg/
       uv_client::cached_client::revalidation_request url="https://example.com/artifactory/api/pypi/my-private-pypi-local/simple/my-pip-pkg/"
        1.529370s   1s  DEBUG uv_client::cached_client Found modified response for: https://example.com/artifactory/api/pypi/my-private-pypi-local/simple/my-pip-pkg/
       uv_client::cached_client::new_cache file=\\?\C:\Users\<USERNAME>\AppData\Local\uv\cache\simple-v12\index\25a5af3375425e52\my-pip-pkg.rkyv
       uv_client::registry_client::parse_simple_api package=my-pip-pkg
         uv_client::html::parse url=https://example.com/artifactory/api/pypi/my-private-pypi-local/simple/my-pip-pkg/
   uv_resolver::version_map::from_metadata
      1.579815s   1s  DEBUG uv_resolver::resolver Searching for a compatible version of my-pip-pkg (*)
      1.580064s   1s  DEBUG uv_resolver::resolver Selecting: my-pip-pkg==1.0.0 [compatible] (my_pip_pkg-1.0.0-py3-none-any.whl)
   uv_distribution::distribution_database::get_or_build_wheel_metadata dist=my-pip-pkg==1.0.0
     uv_client::registry_client::wheel_metadata built_dist=my-pip-pkg==1.0.0
   uv_resolver::resolver::get_dependencies_forking package=my-pip-pkg, version=1.0.0
     uv_resolver::resolver::get_dependencies package=my-pip-pkg, version=1.0.0
       uv_client::cached_client::get_serde
         uv_client::cached_client::get_cacheable
           uv_client::cached_client::read_and_parse_cache file=\\?\C:\Users\<USERNAME>\AppData\Local\uv\cache\wheels-v1\index\25a5af3375425e52\my-pip-pkg\my_pip_pkg-1.0.0-py3-none-any.msgpack
 uv_client::cached_client::from_path_sync path="\\\\?\\C:\\Users\\<USERNAME>\\AppData\\Local\\uv\\cache\\wheels-v1\\index\\25a5af3375425e52\\my-pip-pkg\\my_pip_pkg-1.0.0-py3-none-any.msgpack"
            1.581168s   0ms DEBUG uv_client::cached_client No cache entry for: https://example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c
           uv_client::cached_client::fresh_request url="https://example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c"
              1.638398s  57ms DEBUG uv_client::base_client Transient request failure for: https://example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c
              1.902169s 320ms DEBUG uv_client::base_client Transient request failure for: https://example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c
              2.578114s 996ms DEBUG uv_client::base_client Transient request failure for: https://example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c
              3.588186s   2s  DEBUG uv_client::base_client Transient request failure for: https://example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c
error: Failed to download `my-pip-pkg==1.0.0`
  Caused by: HTTP status server error (500 Internal Server Error) for url (https://example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c)

Note: This error is different from the "500 Internal Server Error" in https://github.com/astral-sh/uv/issues/5600, where the failure message points to an authentication issue.

charliermarsh commented 2 months ago

I think the log you intended to include is empty.

Mushahar commented 2 months ago

I think the log you intended to include is empty.

Thanks, just fixed it.

charliermarsh commented 2 months ago

Thanks. And if you request that URL (https://example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c) with and without credentials, like in your browser, what do you see?

Mushahar commented 2 months ago

I get this response on the browser with and without credentials:

{
  "errors" : [ {
    "status" : 500,
    "message" : "Internal server error"
  } ]
}
Mushahar commented 2 months ago

But when I access the same URL through curl (with credentials) and save the output to a file, I get the correct Whl file downloaded:

(uvtest) C:\>curl -o my_pip_pkg-1.0.0-py3-none-any.whl https://<user>:<apikey>@example.com/artifactory/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl#sha256=ee2bc4dbe9e8ac639cfaf8820db59a32c7c6decbd1e933459bc0c6f71376b96c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1703k  100 1703k    0     0   732k      0  0:00:02  0:00:02 --:--:--  734k
zanieb commented 2 months ago

I'm not sure what we can do with HTTP 500 with no error message — can you get some server-side logs?

Mushahar commented 1 month ago

The Artifactory team seems to think that it's an auth issue. Here is a server-side log I could get:

artifactory-access.log:2024-08-28T18:38:29.323Z [cb31df85820a697c] [DENIED DOWNLOAD] my-private-pypi-local:my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl  for client : NA / 10.10.172.231

artifactory-request.log:2024-08-28T18:38:29.325Z|cb31df85820a697c|10.10.172.231|anonymous|HEAD|/api/pypi/my-private-pypi-local/my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl|500|-1|0|3|uv/0.3.2

{"installer":{"name":"uv","version":"0.3.2"},"python":"3.10.10","implementation":{"name":"CPython","version":"3.10.10"},"distro":null,"system":{"name":"Windows","release":"10"},"cpu":"AMD64","openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

artifactory-service.log:2024-08-28T18:38:29.324Z [jfrt ] [ERROR] [cb31df85820a697c] [.PackageArtifactServiceImpl:95] [tp-nio-8443-exec-642] - Failed to process download for path:my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl in repo:my-private-pypi-local

console.log:2024-08-28T18:38:29.324Z [jfrt ] [ERROR] [cb31df85820a697c] [.PackageArtifactServiceImpl:95] [tp-nio-8443-exec-642] - Failed to process download for path:my-pip-pkg/1.0.0/my_pip_pkg-1.0.0-py3-none-any.whl in repo:my-private-pypi-local
zanieb commented 1 week ago

I'm not really sure what we can do here. It seems like a JFrog bug.