Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyproject.toml with duplicated PyPi and Conda deps still requires PyPi solving #2411

Open
2 tasks done
srilman opened this issue Nov 4, 2024 · 1 comment
Open
2 tasks done
Labels
🐍 pypi Issue related to PyPI dependencies ✨ enhancement Feature request

Comments

@srilman
Copy link

srilman commented Nov 4, 2024

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

I'm working with the following Pixi configuration

[project]
name = "tester"
version = "0.1.0"
requires-python = ">=3.10,<3.13"

dependencies = [
    "numpy>=1.24,<1.27",
]

# -------------------------- Pixi Config --------------------------- #
[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["linux-64", "osx-64", "osx-arm64"]

[tool.pixi.environments]
default = { features = ["py312"], solve-group = "312" }
dev311 = { features = ["py311"], solve-group = "311" }

[tool.pixi.dependencies]
numpy = "*"

[tool.pixi.feature.py312]
dependencies = { python = "3.12.*" }

[tool.pixi.feature.py311]
platforms = ["linux-64"]
dependencies = { python = "3.11.*" }

This unexpectedly raises the error:

× Unable to solve pypi dependencies for the dev311 environment because no compatible python interpreter can be installed for the current
  │ platform
...
  help: Try converting your [pypi-dependencies] to conda [dependencies]

Using Pixi 0.34.0 on a MacOS ARM machine.

Issue description

I'm aware of the error message provided. It is related to #1051, and I understand the reasons behind it. I do not understand why this error appeared in this example, since I attempted to avoid using any PyPi dependencies.

From my understanding, any dependencies specified in project.dependencies will normally be treated as PyPi dependencies under the default feature. But based on the docs in https://pixi.sh/latest/advanced/pyproject_toml/#dependency-section, I expected that respecifying Numpy in tool.pixi.dependencies would override the requirement. But checking pixi info, I see:

Environments
------------
       Environment: default
          Features: py312, default
       Solve group: 312
          Channels: conda-forge
  Dependency count: 2
      Dependencies: python, numpy
 PyPI Dependencies: numpy
  Target platforms: osx-arm64, linux-64, osx-64

       Environment: dev311
          Features: py311, default
       Solve group: 311
          Channels: conda-forge
  Dependency count: 2
      Dependencies: python, numpy
 PyPI Dependencies: numpy
  Target platforms: linux-64

Numpy as specified as both a PyPi and Conda dependency. If I were to comment out the dev311 environment and run pixi install, I see that Pixi attempts to solve for PyPi deps, but the resulting lockfile doesn't contain any.

Is this a bug, or is there an edge case or scenario that I'm not considering where this makes sense? If so, is there a way to explicitly ignore the project dependencies, or should I just use a pixi.toml?

Expected behavior

My expectation is that Numpy would not be considered a PyPi dependency when running pixi info, and that the original Pixi configuration would solve on my existing system on Pixi 0.34.0

@ruben-arts ruben-arts added ✨ enhancement Feature request 🐍 pypi Issue related to PyPI dependencies labels Nov 5, 2024
@ruben-arts
Copy link
Contributor

Thanks for the input! This sounds like a good improvement! Since we have the mapping now we should be able to short circuit this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐍 pypi Issue related to PyPI dependencies ✨ enhancement Feature request
Projects
None yet
Development

No branches or pull requests

2 participants