How to specify multiple Python environments for pixi-build project? #5663
Answered
by
matthewfeickert
matthewfeickert
asked this question in
Q&A
-
|
If I'm trying to create a Python project that uses pixi-build and multiple Pythons for testing [workspace]
channels = ["conda-forge"]
name = "example_pkg"
platforms = ["osx-arm64", "linux-64"]
version = "0.1.0"
preview = ["pixi-build"]
[tasks]
[dependencies]
example_pkg = { path = "." }
[package]
name = "example_pkg"
version = "0.1.0"
[package.build]
backend = { name = "pixi-build-python", version = "0.4.*" }
# c.f. https://pixi.prefix.dev/latest/build/backends/pixi-build-python/#compilers
[package.build.config]
compilers = ["cxx"]
[package.build-dependencies]
cmake = ">=4.2.1"
[package.host-dependencies]
python = ">=3.10.0"
uv = "*"
scikit-build-core = ">=0.11.6"
pybind11 = ">=3.0.1"
pytorch = ">=2.9.1"
geant4 = ">=11.3.2"
clhep = ">=2.4.7.1"
expat = ">=2.6.0"
[package.run-dependencies]
pytorch = ">=2.9.1"
geant4 = ">=11.3.2"
clhep = ">=2.4.7.1"
expat = ">=2.7.1"
[feature.py310.dependencies]
python = "3.10.*"
[feature.py311.dependencies]
python = "3.11.*"
[feature.py312.dependencies]
python = "3.12.*"
[feature.py313.dependencies]
python = "3.13.*"
[feature.py314.dependencies]
python = "3.14.*"
[feature.testing.dependencies]
pytest = "*"
[feature.testing.tasks.tests]
description = "Run tests with pytest"
cmd = "pytest tests/ -v"
[environments]
py310 = { features = ["py310", "testing"], solve-group = "py310" }
py311 = { features = ["py311", "testing"], solve-group = "py311" }
py312 = { features = ["py312", "testing"], solve-group = "py312" }
py313 = { features = ["py313", "testing"], solve-group = "py313" }
py314 = { features = ["py314", "testing"], solve-group = "py314" }How should I specify the Python as a dependency in either $ rm -f pixi.lock && pixi lock
Error: × failed to solve requirements of environment 'py313' for platform 'osx-arm64'
├─▶ × failed to solve the environment
│
╰─▶ Cannot solve the request because of: python 3.13.* cannot be installed because there are no viable options:
└─ python 3.13.0 | 3.13.0 | 3.13.0 | 3.13.0 | 3.13.0 | 3.13.0 | 3.13.1 | 3.13.1 | 3.13.1 | 3.13.1 | 3.13.1 | 3.13.1 | 3.13.1 | 3.13.1 | 3.13.1 | 3.13.1 |
3.13.1 | 3.13.1 | 3.13.2 | 3.13.2 | 3.13.2 | 3.13.2 | 3.13.3 | 3.13.3 | 3.13.3 | 3.13.3 | 3.13.5 | 3.13.5 | 3.13.5 | 3.13.5 | 3.13.5 | 3.13.5 | 3.13.7 |
3.13.7 | 3.13.8 | 3.13.8 | 3.13.9 | 3.13.9 | 3.13.9 | 3.13.9 | 3.13.10 | 3.13.10 | 3.13.11 | 3.13.11 | 3.13.11 | 3.13.11 | 3.13.12 | 3.13.12 would require
└─ python_abi 3.13.* *_cp313t, for which no candidates were found. |
Beta Was this translation helpful? Give feedback.
Answered by
matthewfeickert
Mar 13, 2026
Replies: 1 comment
-
|
@Hofer-Julian very kindly helped me in the Discord 🙇
So the working Pixi manifest is [workspace]
channels = ["conda-forge"]
name = "example_pkg"
platforms = ["linux-64", "osx-arm64"]
version = "0.1.0"
preview = ["pixi-build"]
[workspace.build-variants]
python = ["3.10.*", "3.11.*", "3.12.*", "3.13.*", "3.14.*"]
[tasks]
[dependencies]
example_pkg = { path = "." }
[package]
name = "example_pkg"
version = "0.1.0"
[package.build]
backend = { name = "pixi-build-python", version = "0.4.*" }
# c.f. https://pixi.prefix.dev/latest/build/backends/pixi-build-python/#compilers
[package.build.config]
compilers = ["cxx"]
[package.build-dependencies]
cmake = ">=4.2.1"
[package.host-dependencies]
python = "*"
uv = "*"
scikit-build-core = ">=0.11.6"
pybind11 = ">=3.0.1"
pytorch = ">=2.9.1"
geant4 = ">=11.3.2"
clhep = ">=2.4.7.1"
expat = ">=2.6.0"
[package.run-dependencies]
pytorch = ">=2.9.1"
geant4 = ">=11.3.2"
clhep = ">=2.4.7.1"
expat = ">=2.7.1"
[feature.py310.dependencies]
python = "3.10.*"
[feature.py311.dependencies]
python = "3.11.*"
[feature.py312.dependencies]
python = "3.12.*"
[feature.py313.dependencies]
python = "3.13.*"
[feature.py314.dependencies]
python = "3.14.*"
[feature.testing.dependencies]
pytest = "*"
[feature.testing.tasks.tests]
description = "Run tests with pytest"
cmd = "pytest tests/ -v"
default-environment = "py314"
[environments]
py310 = { features = ["py310", "testing"], solve-group = "py310" }
py311 = { features = ["py311", "testing"], solve-group = "py311" }
py312 = { features = ["py312", "testing"], solve-group = "py312" }
py313 = { features = ["py313", "testing"], solve-group = "py313" }
py314 = { features = ["py314", "testing"], solve-group = "py314" } |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
matthewfeickert
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Hofer-Julian very kindly helped me in the Discord 🙇
So the working Pixi manifest is