Repository navigation
Description
Checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pixi, using
pixi --version.
Reproducible example
When using a non-default PyPI index (e.g., a private Cloudsmith repository), pixi's PyPI package installer always re-downloads packages from remote, even when they are already present in the local uv cache. This defeats Docker buildx cache mounts and significantly slows down CI builds.
The root cause is a hardcoded DEFAULT_PYPI_INDEX_URL in the convert_to_dist() function, which causes a cache key mismatch between the resolution phase (which writes cache entries keyed by the actual index URL) and the installation phase (which looks up cache entries using the hardcoded PyPI URL).
pixi/crates/pixi_install_pypi/src/conversions.rs
Lines 155 to 199 in b938e78
| pkg.requires_python.clone(), | |
| )?; | |
| // Recreate the filename from the extracted last component | |
| // If this errors this is not a valid wheel filename | |
| // and we should consider it a sdist | |
| let filename = WheelFilename::from_str(filename_decoded.as_ref()); | |
| if let Ok(filename) = filename { | |
| Dist::Built(BuiltDist::Registry(RegistryBuiltDist { | |
| wheels: vec![RegistryBuiltWheel { | |
| filename, | |
| file: Box::new(file), | |
| // This should be fine because currently it is only used for caching | |
| // When upgrading uv and running into problems we would need to sort this | |
| // out but it would require adding the indexes to | |
| // the lock file | |
| index: IndexUrl::Pypi(Arc::new(uv_pep508::VerbatimUrl::from_url( | |
| uv_redacted::DisplaySafeUrl::from( | |
| consts::DEFAULT_PYPI_INDEX_URL.clone(), | |
| ), | |
| ))), | |
| }], | |
| best_wheel_index: 0, | |
| sdist: None, | |
| })) | |
| } else { | |
| let pkg_name = to_uv_normalize(&pkg.name)?; | |
| let pkg_version = to_uv_version(&pkg.version)?; | |
| Dist::Source(SourceDist::Registry(RegistrySourceDist { | |
| name: pkg_name, | |
| version: pkg_version, | |
| file: Box::new(file), | |
| // This should be fine because currently it is only used for caching | |
| index: IndexUrl::Pypi(Arc::new(uv_pep508::VerbatimUrl::from_url( | |
| uv_redacted::DisplaySafeUrl::from(consts::DEFAULT_PYPI_INDEX_URL.clone()), | |
| ))), | |
| // I don't think this really matters for the install | |
| wheels: vec![], | |
| ext: SourceDistExtension::from_path(Path::new(filename_raw)).map_err(|e| { | |
| ConvertToUvDistError::Extension(e, filename_raw.to_string()) | |
| })?, | |
| })) | |
| } | |
| } | |
| UrlOrPath::Path(path) => { | |
| let native_path = Path::new(path.as_str()); |
Activity
dhirschfeld commentedon Feb 15, 2026
Some more analysis from the LLM:
The
convert_to_dist()function converts lock filePypiPackageDatainto uvDistobjects forthe installation planner. When constructing a
RegistryBuiltDist(wheel) orRegistrySourceDist(sdist), it hardcodes the index URL:
For wheels
pixi/crates/pixi_install_pypi/src/conversions.rs
Lines 165 to 175 in b938e78
For sdists
pixi/crates/pixi_install_pypi/src/conversions.rs
Lines 186 to 196 in b938e78
1. Cache Structure Evidence
Inspecting the uv-cache inside rattler reveals two different index-keyed directories:
The installation planner looks up
wheels-v5/pypi/numpy/for a cached wheel, but the actual cached metadata was stored underwheels-v5/index/863dd82dcb84841e/numpy/. The.httpfiles underpypi/are only created after pixi downloads the wheel (because theDistobject carries the hardcoded PyPI index URL), so on subsequent runs the lookup still fails — the cache entry written by the resolver and the cache entry read by the installer use different keys.This bug does NOT manifest with the default PyPI index, because in that case both the resolver and the hardcoded value agree on
https://pypi.org/simple/.2. The Cache Comparison: Index URL Mismatch
pixi/crates/pixi_install_pypi/src/plan/cache.rs
Lines 54 to 98 in b938e78
The
CachedWheels::is_cached()method checks registry distributions against the cache.For built wheels
pixi/crates/pixi_install_pypi/src/plan/cache.rs
Lines 71 to 73 in b938e78
For source dists
pixi/crates/pixi_install_pypi/src/plan/cache.rs
Lines 212 to 214 in b938e78
These comparisons are correct — they ensure cache entries match the index the dist claims to be from. The problem is that the
Distobject has a wrong index (hardcoded PyPI) while the cache entries were written by the resolver under the actual index (Cloudsmith).3. The Call Chain
The full call chain from lock data to cache miss:
RequiredDists::from_packages()Calls convert_to_dist() for each locked PyPI package
pixi/crates/pixi_install_pypi/src/plan/required_dists.rs
Lines 32 to 47 in b938e78
convert_to_dist()Creates
Distwith hardcodedIndexUrl::Pypi(DEFAULT_PYPI_INDEX_URL)pixi/crates/pixi_install_pypi/src/conversions.rs
Lines 170 to 173 in b938e78
decide_installation_source()Calls
dist_cache.is_cached(dist, ...)pixi/crates/pixi_install_pypi/src/plan/installation_source.rs
Lines 98 to 105 in b938e78
CachedWheels::is_cached()Compares
entry.index.url()(actual Cloudsmith URL) withwheel.best_wheel().index(hardcoded PyPI URL) → mismatch → returns
Nonepixi/crates/pixi_install_pypi/src/plan/cache.rs
Lines 71 to 73 in b938e78
log_installation_details()logs:
"installing from remote because no version is cached: {name}=={version}"pixi/crates/pixi_install_pypi/src/lib.rs
Lines 680 to 683 in b938e78
4. How the Resolver Writes the Cache
During
pixi lock/ resolution, uv's built-in resolver stores metadata in the cache keyed bythe actual index URL. For a Cloudsmith index, the cache path uses a SHA-256 hash of the URL:
lock_pypi_packages():pixi/crates/pixi_core/src/lock_file/resolve/pypi.rs
Lines 962 to 998 in b938e78
stores the
best_wheel.index(the real index URL from the resolver) into the lock file'sUrlOrPath. This means the lock file URLs point to the actual Cloudsmith download URL, but theindex origin information is lost.
baszalmstra commentedon Feb 15, 2026
This is caused by us not (yet) storing the indexes for each wheel in the lockfile. We are currently working on this.
dhirschfeld commentedon Feb 15, 2026
Thanks @baszalmstra! I did note the TODO in the source! 😆
I wasn't too hopeful I'd track down the problem once I realised it only happened with our internal Cloudsmith package registry. Fortunately the LLM, having access to our package registry, was able to debug!
dhirschfeld commentedon Feb 15, 2026
In case it's useful, here's the dockerfile I used to test:
dhirschfeld commentedon Feb 15, 2026
Given it involves changes to the lockfile I assume it'll be part of: