pixi icon indicating copy to clipboard operation
pixi copied to clipboard

conda-pypi-map misleading error, issues with numpy

Open niemiaszek opened this issue 2 years ago • 7 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

[project]
channels = ["https://fast.prefix.dev/conda-forge"]
description = "Add a short description here"
name = "mapping-test"
platforms = ["linux-64"]
version = "0.1.0"
conda-pypi-map = {"pytorch" = "local_mapping.json" }


[tasks]

[dependencies]

[feature.pytorch]
channels = ["https://fast.prefix.dev/conda-forge", "pytorch"]

[feature.pytorch.dependencies]
pytorch = {version="*", channel="pytorch"}
torchvision = {version="*", channel="pytorch"}
torchaudio = {version="*", channel="pytorch"}
cpuonly = {version="*", channel="pytorch"}

[feature.pytorch.pypi-dependencies]
pyannote-audio = "*"

[environments]
pytorch = ["pytorch"]

Please note that local mapping is default mapping with appended "torchaudio":"torchaudio", even tho it's not that important for this example.

Issue description

Resolving this env on newest pixi gives an error (?) "× Defined conda-pypi-map channel: pytorch is missing from the channels, which are: https://fast.prefix.dev/conda-forge/". It made me think that something changed with mapping. Previously there were a different warning for this case, when mapped channel was not present in default env. I tried moving conda-pypi-map to feature specification, but it's illegal.

Switching to 0.27.1 I got an actual error:

× failed to solve the pypi requirements of 'pytorch' 'linux-64'
  ├─▶ Failed to build: `numba==0.51.2`
  ├─▶ Failed to install requirements from build-system.requires (install)
  ├─▶ Failed to prepare distributions
  ├─▶ Failed to fetch wheel: numpy==2.1.1
  ├─▶ Failed to extract archive
  ╰─▶ Unsupported archive type: numpy

It might be related to #1966

Attached env only solves when numpy="<2.0" is added for me. On my other env I had silent failure for some pixi add, which was not really adding anything and I had to add it manually to .toml.

Expected behavior

Pixi resolves and installs env sucessfully or at least gives informative error.

niemiaszek avatar Sep 05 '24 13:09 niemiaszek

× Defined conda-pypi-map channel: pytorch is missing from the channels, which are: fast.prefix.dev/conda-forge".

The error indicates that you have a mapping for a channel you didnt add to the channels key. If you change:

channels = ["https://fast.prefix.dev/conda-forge"] 

to

channels = ["https://fast.prefix.dev/conda-forge", "pytorch"]

this error should go away.

baszalmstra avatar Sep 05 '24 14:09 baszalmstra

@baszalmstra I don't think that's exactly the case. What if I want to use the mapping for some channel that is not present in default environment? In this toy example I use pytorch channel only for one feature.

What's more, that's not even the root cause of error with this environment. The root error is not printed on this version of Pixi and I have to downgrade to actually see the error. After fixing the root error (numpy version) and upgrading Pixi back to latest, error with mapping is gone

niemiaszek avatar Sep 05 '24 14:09 niemiaszek

@nichmor It look like the error

× Defined conda-pypi-map channel: pytorch is missing from the channels, which are: [fast.prefix.dev/conda-forge](https://fast.prefix.dev/conda-forge/)

Is incorrect in this case because the specific feature does include the pytorch channel. Would you be able to take a look?

baszalmstra avatar Sep 05 '24 14:09 baszalmstra

@nichmor It look like the error

× Defined conda-pypi-map channel: pytorch is missing from the channels, which are: [fast.prefix.dev/conda-forge](https://fast.prefix.dev/conda-forge/)

Is incorrect in this case because the specific feature does include the pytorch channel. Would you be able to take a look?

sure! Let me look at this tomorrow!

nichtmacho avatar Sep 05 '24 14:09 nichtmacho

@nichmor It's worth to note that in pixi 0.29 these examples work well even without conda-pypi-mapping, as you added pytorch mapping to Parselmouth. Thank you! However, for the general sake of mapping I think there still is a bug.

When I remove the mapping on 0.29, I get the core root error:

× failed to solve the pypi requirements of 'pytorch' 'linux-64'
  ╰─▶ Build backend failed to determine metadata through `prepare_metadata_for_build_wheel` with exit status: 1
      --- stdout:
      
      --- stderr:
      Traceback (most recent call last):
        File "<string>", line 14, in <module>
        File "/home/p.niemiec/.cache/rattler/cache/uv-cache/builds-v0/.tmpLVfzfv/lib/python3.12/site-packages/setuptools/build_meta.py", line 373, in
      prepare_metadata_for_build_wheel
          self.run_setup()
        File "/home/p.niemiec/.cache/rattler/cache/uv-cache/builds-v0/.tmpLVfzfv/lib/python3.12/site-packages/setuptools/build_meta.py", line 503, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/home/p.niemiec/.cache/rattler/cache/uv-cache/builds-v0/.tmpLVfzfv/lib/python3.12/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
        File "<string>", line 354, in <module>
        File "<string>", line 87, in get_ext_modules
      ModuleNotFoundError: No module named 'numpy.distutils'

Fixing numpy in dependencies to `numpy="~=2.0.0" fixes the errors and gives functioning env. Somehow the newest numpy version errors out. But it's unrelated to the mapping bug and there is already issue 1966 for that.

niemiaszek avatar Sep 06 '24 10:09 niemiaszek

hey @niemiaszek ! I can confirm that indeed this wrongly error out on Defined conda-pypi-map channel: pytorch is missing from the channels,.

I'm working on fixing this.

Meanwhile, I think you can safely remove conda-pypi-map = {"pytorch" = "local_mapping.json" } as we added pytorch mapping in our database. just run pixi clean cache --mapping

nichtmacho avatar Sep 11 '24 14:09 nichtmacho

@nichmor thanks! Looks like this PR will fix the issue for conda-pypi-map. I removed mapping in my case and I confirm that it works well on PyTorch channel :)

niemiaszek avatar Sep 11 '24 16:09 niemiaszek