Skip to content

no-binary PyPI source builds are reused across environments with different conda-side build inputs #6226

Closed

Description

@thomas-maschler

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

Commands I ran and their output:

$ pixi clean cache --pypi --build -y
$ rm -rf .pixi
$ pixi install -e gdal-310
✔ The gdal-310 environment has been installed.

$ pixi run -e gdal-310 verify-gdal
rasterio.__gdal_version__: 3.10.3
gdalinfo: GDAL 3.10.3, released 2025/04/01

$ pixi install -e gdal-313
✔ The gdal-313 environment has been installed.

$ pixi run -e gdal-313 verify-gdal
rasterio.__gdal_version__: 3.10.3                        # ← BUG (expected 3.13.0)
gdalinfo: GDAL 3.13.0 "Iowa City", released 2026/05/04

Hard evidence that the same compiled artifact is being reused:

$ shasum .pixi/envs/gdal-310/lib/python3.12/site-packages/rasterio/_base.cpython-312-darwin.so \
         .pixi/envs/gdal-313/lib/python3.12/site-packages/rasterio/_base.cpython-312-darwin.so
d9d1ee8ac7a8ec2a05481a2144c22f2dadefdb16  …/gdal-310/…/_base.cpython-312-darwin.so
d9d1ee8ac7a8ec2a05481a2144c22f2dadefdb16  …/gdal-313/…/_base.cpython-312-darwin.so

$ otool -L .pixi/envs/gdal-313/lib/python3.12/site-packages/rasterio/_base.cpython-312-darwin.so | grep libgdal
	@rpath/libgdal.36.dylib (compatibility version 36.0.0, current version 36.3.10)

$ ls .pixi/envs/gdal-313/lib/libgdal*.dylib
.pixi/envs/gdal-313/lib/libgdal.39.3.13.0.dylib       # ← env actually pins libgdal 3.13 (SONAME .39)
.pixi/envs/gdal-313/lib/libgdal.39.dylib              #    but the wheel above wants libgdal.36
.pixi/envs/gdal-313/lib/libgdal.dylib

Both environments receive the byte-identical _base.cpython-312-darwin.so, both linked against libgdal.36.dylib (libgdal-3.10's SONAME). The gdal-313 env doesn't even ship libgdal.36.dylib; the link only "works" because something else on the load path resolves it.

The reused wheel sits in pixi's uv-side cache:

$ ls ~/Library/Caches/rattler/cache/uv-cache/sdists-v9/pypi/rasterio/1.5.0/
77Zd1pSoQcCVsGJyi0MDR/

The build-key directory hash (77Zd1pSoQcCVsGJyi0MDR) appears to be derived from the sdist + Python version + platform, but not from the resolved conda-side environment. So any source build whose ABI is decided by a non-PyPI dependency is cached unsoundly across environments.

Workaround:

$ pixi clean cache --pypi --build -y
$ rm -rf .pixi/envs/<env>
$ pixi install -e <env>

pixi.toml/pyproject.toml file that reproduces my issue:

[project]
name = "pixi-rasterio-gdal-bug"
version = "0.0.0"
requires-python = ">=3.12"

[tool.pixi.workspace]
channels = ["conda-forge"]
platforms = ["osx-arm64", "linux-64"]

[tool.pixi.pypi-options]
no-binary = ["rasterio"]

[tool.pixi.pypi-dependencies]
rasterio = "*"

[tool.pixi.tasks]
verify-gdal = "python -c \"import rasterio, subprocess; print('rasterio.__gdal_version__:', rasterio.__gdal_version__); print('gdalinfo:', subprocess.check_output(['gdalinfo','--version'], text=True).strip())\""

[tool.pixi.environments]
gdal-310 = ["gdal-310"]
gdal-313 = ["gdal-313"]

[tool.pixi.feature.gdal-310.dependencies]
python = "3.12.*"
libgdal = "==3.10.3"

[tool.pixi.feature.gdal-313.dependencies]
python = "3.12.*"
libgdal = "==3.13.0"

pixi info output:

System
------------
       Pixi version: 0.69.0
        TLS backend: rustls
           Platform: osx-arm64
   Virtual packages: __unix=0=0
                   : __osx=15.7.7=0
                   : __archspec=1=m2
          Cache dir: /Users/thomas.mashler/Library/Caches/rattler/cache

Workspace
------------
               Name: pixi-rasterio-gdal-bug
            Version: 0.0.0
      Manifest file: /private/tmp/pixi-rasterio-gdal-bug/pyproject.toml

Environments
------------
        Environment: gdal-310
           Features: gdal-310, default
        Solve group: gdal-310
           Channels: conda-forge
   Dependency count: 2
       Dependencies: python, libgdal
  PyPI Dependencies: rasterio
   Target platforms: linux-64, osx-arm64

        Environment: gdal-313
           Features: gdal-313, default
        Solve group: gdal-313
           Channels: conda-forge
   Dependency count: 2
       Dependencies: python, libgdal
  PyPI Dependencies: rasterio
   Target platforms: osx-arm64, linux-64

Other files (e.g. script files, source files, etc.):

The reproducer above is self-contained; there are no other files. rasterio is used because it is a real-world no-binary PyPI package that links against a conda-provided C library (libgdal), but the issue is not GDAL-specific — any source build whose ABI is determined by a conda-side dependency should be vulnerable.

Issue description

Summary

When two pixi environments resolve different versions of a conda-side native library that a no-binary PyPI package links against, pixi reuses the same built wheel for both environments. The wheel is built once against whichever environment is solved first; subsequent environments receive a byte-identical wheel even though their conda-resolved native library has a different SONAME / ABI. The result is silently broken linkage — the package activates fine, but at runtime it loads against a native library other than the one the environment pins.

Suggested directions

  1. Include the resolved conda-environment hash (or the set of conda package versions) in the source-build cache key for no-binary PyPI packages, so wheels are rebuilt when the underlying native dependencies change.
  2. Or, disable wheel-cache reuse across environments for no-binary packages by default, with an opt-in escape hatch.

Expected behavior

$ pixi clean cache --pypi --build -y
$ rm -rf .pixi
$ pixi install -e gdal-310
✔ The gdal-310 environment has been installed.

$ pixi run -e gdal-310 verify-gdal
rasterio.gdal_version: 3.10.3
gdalinfo: GDAL 3.10.3, released 2025/04/01

$ pixi install -e gdal-313
✔ The gdal-313 environment has been installed.

$ pixi run -e gdal-313 verify-gdal
rasterio.gdal_version: 3.13.0
gdalinfo: GDAL 3.13.0 "Iowa City", released 2026/05/04

Activity

  1. added
    bug
    on May 28, 2026
  2. ruben-arts commented on May 29, 2026

    @ruben-arts
    Contributor

    Thank you for this amazing reproducer! We're working on a fix

  3. added a commit that references this issue on May 29, 2026
    8a9d251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions