pixi icon indicating copy to clipboard operation
pixi copied to clipboard

dependency-overrides for pypi package

Open VaasuDevanS opened this issue 10 months ago • 6 comments

Checks

  • [x] I have checked that this issue has not already been reported.

  • [x] I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

pixi still uses conda-forge to download and install dependencies though I mentioned it should come from pypi. Isn't this the use case for pypi-options.dependency-overrides. Am I missing something?

Commands I ran and their output:

pixi init test
cd test/
pixi add "python==3.13.*"
pixi add requests
pixi add urllib3 --pypi
pixi update

pixi.toml file that reproduces my issue:

[workspace]
authors = ["VaasuDevanS <[email protected]>"]
channels = ["conda-forge"]
name = "test"
platforms = ["osx-arm64"]
version = "0.1.0"

[tasks]

[dependencies]
python = "3.13.*"
requests = ">=2.32.5,<3"

[pypi-options.dependency-overrides]
urllib3 = "*"

[pypi-dependencies]
urllib3 = "*"

pixi info output:

System
------------
       Pixi version: 0.63.2
        TLS backend: rustls
           Platform: osx-arm64
   Virtual packages: __unix=0=0
                   : __osx=26.2=0
                   : __archspec=1=m1
          Cache dir: /Users/vaasu/Library/Caches/rattler/cache
       Auth storage: /Users/vaasu/.rattler/credentials.json
   Config locations: No config files found

Global
------------
            Bin dir: /Users/vaasu/.pixi/bin
    Environment dir: /Users/vaasu/.pixi/envs
       Manifest dir: /Users/vaasu/.pixi/manifests/pixi-global.toml

pixi list output:

Name                Version   Build                     Size  Kind   Source
backports.zstd      1.3.0     py313h48bb75e_0     238.64 KiB  conda  https://conda.anaconda.org/conda-forge
brotli-python       1.2.0     py313hde1f3bb_1     351.14 KiB  conda  https://conda.anaconda.org/conda-forge
bzip2               1.0.8     hd037594_8          122.13 KiB  conda  https://conda.anaconda.org/conda-forge
ca-certificates     2026.1.4  hbd8a1cb_0          143.08 KiB  conda  https://conda.anaconda.org/conda-forge
certifi             2026.1.4  pyhd8ed1ab_0        147.43 KiB  conda  https://conda.anaconda.org/conda-forge
charset-normalizer  3.4.4     pyhd8ed1ab_0         49.77 KiB  conda  https://conda.anaconda.org/conda-forge
h2                  4.3.0     pyhcf101f3_0         93.72 KiB  conda  https://conda.anaconda.org/conda-forge
hpack               4.1.0     pyhd8ed1ab_0         30.01 KiB  conda  https://conda.anaconda.org/conda-forge
hyperframe          6.1.0     pyhd8ed1ab_0         16.99 KiB  conda  https://conda.anaconda.org/conda-forge
icu                 78.2      h38cb7af_0           11.79 MiB  conda  https://conda.anaconda.org/conda-forge
idna                3.11      pyhd8ed1ab_0         49.53 KiB  conda  https://conda.anaconda.org/conda-forge
libcxx              21.1.8    hf598326_0          555.78 KiB  conda  https://conda.anaconda.org/conda-forge
libexpat            2.7.3     haf25636_0           66.21 KiB  conda  https://conda.anaconda.org/conda-forge
libffi              3.5.2     hcf2aa1b_0           40.02 KiB  conda  https://conda.anaconda.org/conda-forge
liblzma             5.8.2     h8088a28_0           90.08 KiB  conda  https://conda.anaconda.org/conda-forge
libmpdec            4.0.0     h84a0fba_1           71.96 KiB  conda  https://conda.anaconda.org/conda-forge
libsqlite           3.51.2    h1ae2325_0          888.45 KiB  conda  https://conda.anaconda.org/conda-forge
libzlib             1.3.1     h8359307_2           45.35 KiB  conda  https://conda.anaconda.org/conda-forge
ncurses             6.5       h5e97a16_3          778.35 KiB  conda  https://conda.anaconda.org/conda-forge
openssl             3.6.0     h5503f6c_0            2.96 MiB  conda  https://conda.anaconda.org/conda-forge
pysocks             1.7.1     pyha55dd90_7         20.59 KiB  conda  https://conda.anaconda.org/conda-forge
python              3.13.11   hfc2f54d_101_cp313   12.21 MiB  conda  https://conda.anaconda.org/conda-forge
python_abi          3.13      8_cp313               6.84 KiB  conda  https://conda.anaconda.org/conda-forge
readline            8.3       h46df422_0          306.57 KiB  conda  https://conda.anaconda.org/conda-forge
requests            2.32.5    pyhcf101f3_1         62.11 KiB  conda  https://conda.anaconda.org/conda-forge
tk                  8.6.13    h010d191_3            2.98 MiB  conda  https://conda.anaconda.org/conda-forge
tzdata              2025c     hc9c84f9_1          116.34 KiB  conda  https://conda.anaconda.org/conda-forge
urllib3             2.6.3     pyhd8ed1ab_0        100.75 KiB  conda  https://conda.anaconda.org/conda-forge
zstd                1.5.7     hbf9d68e_6          423.25 KiB  conda  https://conda.anaconda.org/conda-forge

Issue description

No response

Expected behavior

pixi should download mentioned "overridden" dependencies from pypi.

VaasuDevanS avatar Jan 27 '26 04:01 VaasuDevanS

hey @VaasuDevanS !

I think in this case, urllib3 is coming from conda because in our mapping ( https://github.com/prefix-dev/parselmouth ), they are exactly the same.

dependency-overrides is used to relax or change the version of the library, in case of conflict with other versions of other libraries ( but it does not tell to use pypi one instead of conda).

What's your usecase? why do you need specifically urllib3 from PyPI?

nichtmacho avatar Jan 27 '26 17:01 nichtmacho

It's not related to requests exactly. My issue is with another package called arcpy. I was able to successfully install based on https://github.com/prefix-dev/pixi/issues/5390#issuecomment-3783168240.

After I add conda-forge to channels (in addition to esri, main), lxml package (a dependency of arcpy) is being downloaded from conda-forge but I get ImportError (from lxml import etree) related to missing dll and this was fixed by removing conda-forge from channels and adding it as pypi dependency.

This dll error might be related to the arcpy package itself and not related to pixi but this made me wondering if I could specify and install a package from conda-forge and one of it's dependency from pypi. I saw the dependency-overrides setting and thought this was it. But I guess this is not the solution for my problem.

VaasuDevanS avatar Jan 27 '26 22:01 VaasuDevanS

In this case, the right way of fixing it is to report to the upstream package.

We could also expose something like preffer-pypi, so we forcefully override a conda package. wdyt @tdejager

nichtmacho avatar Jan 28 '26 10:01 nichtmacho

The problem is that there are no guarantees that this will then actually work.

tdejager avatar Jan 28 '26 10:01 tdejager

~~I just had another thought, we could also make dependency-override for conda, and then disable the dependency you want as a PyPI dependency. It would be on you (as the user) to make the environment work out. However, this would make it explicit that your are disabling the dependency for that conda package. Also, that feature might be useful in intself. wdyt?~~

My bad, I was confusing two features, I thought we should implement this for PyPI anyways: https://docs.astral.sh/uv/concepts/resolution/#dependency-metadata for specific setup.py builds :)

But also we could have a similar variant for conda dependencies and you could remove the urrlib dependency from the conda package that is pulling it in.

tdejager avatar Jan 28 '26 10:01 tdejager

I'm closing this for now as we will not be fixing this currenty,.

tdejager avatar Jun 05 '26 09:06 tdejager