pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Resolve-time python dependency for uv cross platform pypi resolving

Open gzm55 opened this issue 1 year ago • 4 comments

Problem description

When cross platform resolving packages, a python dependency on the current platform is required for resolving pypi dependencies. This may block the resolving or make the pixi.toml hard to maintain. Can we add a temporary env on the current platform with only python dependency if pixi cannot find the python package. The packages in the temporary env (such as __uv-python) should not be written into the pixi.lock.

conda packages already works

platforms = [  "linux-64"  ]

[dependencies]
click = '*'

This can be locked on both linux-64 and osx-arm64.

pypi packages do not works.

platforms = [  "linux-64"  ]

[dependencies]
python = '*'

[pypi-dependencies]
click = '*'

This can be locked on linux-64, but fail to lock on osx-arm64, error message:

✦ ❯ pixi lock
Error:   × Unable to solve pypi dependencies for the default environment — no compatible Python interpreter for 'osx-arm64'
  help: Try: pixi workspace platform add osx-arm64

We cannot add osx-arm64 platform since some pypi dependencies can only be resolved on linux-64.

a workaround

platforms = [
  "linux-64",
  "linux-aarch64",
  "osx-arm64",
  ]

[dependencies]
python ='*'

[target.linux-64.pypi-dependencies]
click = '*'
[target.linux-aarch64.pypi-dependencies]
click = '*'

This can also be locked on osx-arm64. But multiple real target platforms make the toml hard to maintain. Also all the resolve-time platforms have to be list in toml and locked to pixi.lock which are all unnecessary after resolving work.

gzm55 avatar Jun 04 '25 16:06 gzm55

hey!

Could you please give me more details regarding this issue? I'm on osx-arm64, I can pixi install this toml and produce a lockfile:

[workspace]
authors = ["nichmor <[email protected]>"]
channels = ["conda-forge"]
name = "boltons"
platforms = ["osx-arm64", "linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
python = '*'

[pypi-dependencies]
click = '*'

Do you mean that you would like to skip specifying python here, so it will automatically pick up the right Python?

nichtmacho avatar Jun 16 '25 09:06 nichtmacho

hey!

Could you please give me more details regarding this issue? I'm on osx-arm64, I can pixi install this toml and produce a lockfile:

[workspace]
authors = ["nichmor <[email protected]>"]
channels = ["conda-forge"]
name = "boltons"
platforms = ["osx-arm64", "linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
python = '*'

[pypi-dependencies]
click = '*'

Do you mean that you would like to skip specifying python here, so it will automatically pick up the right Python?

hi, @nichmor this is a pixi.toml to reproduce the error on osx.

[workspace]
authors = []
channels = ["conda-forge"]
name = "test-uv"
platforms = ["linux-64"]

[dependencies]
python = '*'

[pypi-dependencies]
click = '*'

Error message

Error:   × Unable to solve pypi dependencies for the default environment — no compatible Python interpreter for 'osx-arm64'
  help: Try: pixi workspace platform add osx-arm64

gzm55 avatar Jun 16 '25 10:06 gzm55

Unfortunately, it is a limitation right now and it is related to https://github.com/prefix-dev/pixi/issues/3081 and a similar one https://github.com/prefix-dev/pixi/issues/1130.

We have it in our backlog, but unfortunately, I can't give you an exact timeline when we will work on this as an elegant solution for this would require some design thoughts.

nichtmacho avatar Jun 23 '25 19:06 nichtmacho

closing in favor of https://github.com/prefix-dev/pixi/issues/3081

let me know if you will have other questions

nichtmacho avatar Jun 23 '25 19:06 nichtmacho