Repository navigation
Closed
Description
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
Create a pixi.toml (I'm essentially trying to create an env for florence2):
[project]
authors = ["me <[email protected]>"]
channels = ["nvidia", "conda-forge"]
description = "Add a short description here"
name = "florence2"
platforms = ["linux-64"]
version = "0.1.0"
[dependencies]
python = "*"
cuda-toolkit = "*"
cuda = "*"
[pypi-dependencies]
jupyterlab = "*"
transformers = "*"
datasets = "*"
matplotlib = "*"
torch = "*"
torchvision = "*"
requests = "*"
timm = "*"
flash-attn = "*"
einops = "*"
accelerate = "*"
pillow = "*"Then running pixi install yields:
⠴ default:linux-64 [00:00:03] resolving flash-attn==2.6.3 × failed to solve the pypi requirements of 'default' 'linux-64'
├─▶ failed to resolve pypi dependencies
├─▶ Failed to download and build `flash-attn==2.6.3`
├─▶ Failed to build: `flash-attn==2.6.3`
╰─▶ Build backend failed to determine extra requires with `build_wheel()` with exit status: 1
--- stdout:
--- stderr:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "~/pixi_cache/uv-cache/environments-v0/.tmp6AntAq/lib/python3.12/site-
packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/pixi_cache/uv-cache/environments-v0/.tmp6AntAq/lib/python3.12/site-
packages/setuptools/build_meta.py", line 302, in _get_build_requires
self.run_setup()
File "~/pixi_cache/uv-cache/environments-v0/.tmp6AntAq/lib/python3.12/site-
packages/setuptools/build_meta.py", line 502, in run_setup
super().run_setup(setup_script=setup_script)
File "~/pixi_cache/uv-cache/environments-v0/.tmp6AntAq/lib/python3.12/site-
packages/setuptools/build_meta.py", line 318, in run_setup
exec(code, locals())
File "<string>", line 21, in <module>
ModuleNotFoundError: No module named 'torch'
---Issue description
Possibly related to #1834
Expected behavior
I originally created the environment with mamba and it successfully installs/runs. Here is the exported environment.yaml
name: florence2
channels:
- nvidia
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_gnu
- _sysroot_linux-64_curr_repodata_hack=3=h69a702a_16
- binutils_impl_linux-64=2.40=ha1999f0_7
- binutils_linux-64=2.40=hb3c18ed_0
- bzip2=1.0.8=h4bc722e_7
- ca-certificates=2024.7.4=hbcca054_0
- cuda=12.6.0=0
- cuda-cccl=12.6.37=0
- cuda-cccl_linux-64=12.6.37=0
- cuda-command-line-tools=12.6.0=0
- cuda-compiler=12.6.0=0
- cuda-crt-dev_linux-64=12.6.20=ha770c72_0
- cuda-crt-tools=12.6.20=ha770c72_0
- cuda-cudart=12.6.37=0
- cuda-cudart-dev=12.6.37=0
- cuda-cudart-dev_linux-64=12.6.37=0
- cuda-cudart-static=12.6.37=0
- cuda-cudart-static_linux-64=12.6.37=0
- cuda-cudart_linux-64=12.6.37=0
- cuda-cuobjdump=12.6.20=0
- cuda-cupti=12.6.37=0
- cuda-cupti-dev=12.6.37=0
- cuda-cuxxfilt=12.6.20=0
- cuda-driver-dev=12.6.37=0
- cuda-driver-dev_linux-64=12.6.37=0
- cuda-gdb=12.6.37=0
- cuda-libraries=12.6.0=0
- cuda-libraries-dev=12.6.0=0
- cuda-nsight=12.6.20=0
- cuda-nvcc=12.6.20=0
- cuda-nvcc-dev_linux-64=12.6.20=he91c749_0
- cuda-nvcc-impl=12.6.20=h85509e4_0
- cuda-nvcc-tools=12.6.20=he02047a_0
- cuda-nvcc_linux-64=12.6.20=0
- cuda-nvdisasm=12.6.20=0
- cuda-nvml-dev=12.6.37=2
- cuda-nvprof=12.6.37=0
- cuda-nvprune=12.6.20=0
- cuda-nvrtc=12.6.20=0
- cuda-nvrtc-dev=12.6.20=0
- cuda-nvtx=12.6.37=0
- cuda-nvvm-dev_linux-64=12.6.20=ha770c72_0
- cuda-nvvm-impl=12.6.20=he02047a_0
- cuda-nvvm-tools=12.6.20=he02047a_0
- cuda-nvvp=12.6.37=0
- cuda-opencl=12.6.37=0
- cuda-opencl-dev=12.6.37=0
- cuda-profiler-api=12.6.37=0
- cuda-runtime=12.6.0=0
- cuda-sanitizer-api=12.6.34=0
- cuda-toolkit=12.6.0=0
- cuda-tools=12.6.0=0
- cuda-version=12.6=3
- cuda-visual-tools=12.6.0=0
- gcc_impl_linux-64=13.3.0=hfea6d02_0
- gcc_linux-64=13.3.0=hc28eda2_0
- gds-tools=1.11.0.15=0
- gmp=6.3.0=hac33072_2
- gxx_impl_linux-64=13.3.0=hdbfa832_0
- gxx_linux-64=13.3.0=h6834431_0
- kernel-headers_linux-64=3.10.0=h4a8ded7_16
- ld_impl_linux-64=2.40=hf3520f5_7
- libcublas=12.6.0.22=0
- libcublas-dev=12.6.0.22=0
- libcufft=11.2.6.28=0
- libcufft-dev=11.2.6.28=0
- libcufile=1.11.0.15=0
- libcufile-dev=1.11.0.15=0
- libcurand=10.3.7.37=0
- libcurand-dev=10.3.7.37=0
- libcusolver=11.6.4.38=0
- libcusolver-dev=11.6.4.38=0
- libcusparse=12.5.2.23=0
- libcusparse-dev=12.5.2.23=0
- libexpat=2.6.2=h59595ed_0
- libffi=3.4.2=h7f98852_5
- libgcc-devel_linux-64=13.3.0=h84ea5a7_100
- libgcc-ng=14.1.0=h77fa898_0
- libgomp=14.1.0=h77fa898_0
- libnpp=12.3.1.23=0
- libnpp-dev=12.3.1.23=0
- libnsl=2.0.1=hd590300_0
- libnvfatbin=12.6.20=0
- libnvfatbin-dev=12.6.20=0
- libnvjitlink=12.6.20=0
- libnvjitlink-dev=12.6.20=0
- libnvjpeg=12.3.3.23=0
- libnvjpeg-dev=12.3.3.23=0
- libsanitizer=13.3.0=heb74ff8_0
- libsqlite=3.46.0=hde9e2c9_0
- libstdcxx-devel_linux-64=13.3.0=h84ea5a7_100
- libstdcxx-ng=14.1.0=hc0a3c3a_0
- libuuid=2.38.1=h0b41bf4_0
- libxcrypt=4.4.36=hd590300_1
- libzlib=1.3.1=h4ab18f5_1
- ncurses=6.5=h59595ed_0
- nsight-compute=2024.1.1.4=0
- openssl=3.3.1=h4bc722e_2
- pip=24.2=pyhd8ed1ab_0
- python=3.12.5=h2ad013b_0_cpython
- readline=8.2=h8228510_1
- setuptools=72.2.0=pyhd8ed1ab_0
- sysroot_linux-64=2.17=h4a8ded7_16
- tk=8.6.13=noxft_h4845f30_101
- wheel=0.44.0=pyhd8ed1ab_0
- xz=5.2.6=h166bdaf_0
- pip:
- accelerate==0.33.0
- aiohappyeyeballs==2.4.0
- aiohttp==3.10.5
- aiosignal==1.3.1
- attrs==24.2.0
- certifi==2024.7.4
- charset-normalizer==3.3.2
- datasets==2.21.0
- dill==0.3.8
- einops==0.8.0
- filelock==3.15.4
- flash-attn==2.6.3
- frozenlist==1.4.1
- fsspec==2024.6.1
- huggingface-hub==0.24.6
- idna==3.7
- jinja2==3.1.4
- markupsafe==2.1.5
- mpmath==1.3.0
- multidict==6.0.5
- multiprocess==0.70.16
- networkx==3.3
- numpy==1.26.4
- nvidia-cublas-cu12==12.1.3.1
- nvidia-cuda-cupti-cu12==12.1.105
- nvidia-cuda-nvrtc-cu12==12.1.105
- nvidia-cuda-runtime-cu12==12.1.105
- nvidia-cudnn-cu12==9.1.0.70
- nvidia-cufft-cu12==11.0.2.54
- nvidia-curand-cu12==10.3.2.106
- nvidia-cusolver-cu12==11.4.5.107
- nvidia-cusparse-cu12==12.1.0.106
- nvidia-nccl-cu12==2.20.5
- nvidia-nvjitlink-cu12==12.6.20
- nvidia-nvtx-cu12==12.1.105
- packaging==24.1
- pandas==2.2.2
- pillow==10.4.0
- psutil==6.0.0
- pyarrow==17.0.0
- python-dateutil==2.9.0.post0
- pytz==2024.1
- pyyaml==6.0.2
- regex==2024.7.24
- requests==2.32.3
- safetensors==0.4.4
- six==1.16.0
- sympy==1.13.2
- timm==1.0.8
- tokenizers==0.19.1
- torch==2.4.0
- torchvision==0.19.0
- tqdm==4.66.5
- transformers==4.44.1
- triton==3.0.0
- typing-extensions==4.12.2
- tzdata==2024.1
- urllib3==2.2.2
- xxhash==3.5.0
- yarl==1.9.4
Activity
[-]Cant' recreate a mamba environment with pixi (getting `ModuleNotFoundError: No module named 'torch'`)[/-][+]Can't recreate a mamba environment with pixi (getting `ModuleNotFoundError: No module named 'torch'`)[/+]tdejager commentedon Aug 22, 2024
Yes this is related to this issue, that you mentioned :)
tdejager commentedon Aug 22, 2024
We are in the process of getting
no-build-isolationin :)tdejager commentedon Sep 3, 2024
Hey we've now added
build-isolationoptions in main: https://pixi.sh/dev/reference/project_configuration/#no-build-isolation. Should be released really soon, let me know if it works and feel free to re-open if it does not.asmith26 commentedon Sep 6, 2024
Hi @tdejager, thanks for the info and your help. It looks like this has been added (https://github.com/prefix-dev/pixi/releases/tag/v0.29.0), so I've updated my pixi version, removed my old env, and updated my
pixi.tomlfile as follows:Unfortunately I seem to be getting:
Not sure if you can see anything obvious I'm missing? Thanks again!
tdejager commentedon Sep 6, 2024
Hi @asmith26 thanks for testing it out! So, I had to fiddle a bit because I'm on apple silicon and have a hard time reproducing anything cuda related. But I think this should work (minimal version):
The important thing is to use pytorch from conda, the conda prefix (installation directory) is created before installing the pypi dependencies and essentially supplies the torch version for the PyPI build.
edit:
According to @baszalmstra we can even forego the nvidia channel, lets give that a try:
tdejager commentedon Sep 6, 2024
I'm re-opening until we consider this working.
asmith26 commentedon Sep 6, 2024
Many thanks for all your help/time @tdejager! I've got it working, and for completeness here are various combinations (checked all are using cuda with
pixi run python -c "import torch; print(torch.cuda.is_available())":Thanks again!
asmith26 commentedon Sep 6, 2024
I have noticed one thing: if I spin up a fresh cloud VM, when running
pixi installwith the above pypi examples I hit the aboveModuleNotFoundError: No module named 'torch'.However, if I remove the
flash-attn = "*"and runpixi install, the environment installs successfully - if I then re-add theflash-attn = "*"and runpixi install, I get my desired environment withtorchandflash-attn.Also interestingly, if I then (on the same/already running VM), copy my latest pyproject.toml (with the
flash-attndependency) to another new folder and runpixi install, it works successfully (without having to got through the process above ofremove flash-attn -> pixi install -> readd flash-attn - > pixi install).This feels like a bug? I can write a clearer step-by-step reproduction of this if helpful?
tdejager commentedon Sep 7, 2024
That's interesting! Does this also happen if you run a 'pixi clean' and pixi cache clean' and 'rm pixi.lock' to reproduce locally as well?
asmith26 commentedon Sep 7, 2024
Hi @tdejager, can confirm that on a machine where I have the following
pyproject.tomlworking successfully:If I then run the following, I get
ModuleNotFoundError: No module named 'torch':$ pixi clean $ pixi clean cache $ rm pixi.lock $ pixi install # errors with `ModuleNotFoundError: No module named 'torch'`tdejager commentedon Sep 8, 2024
Hey @asmith26 that example has
torchas a pypi-dependency again :) So it will not work for the same reasons as before.asmith26 commentedon Sep 8, 2024
Cool, I'll proceed with with the conda version, although it does seem strange that the pypi version works if I first install
torch, and then later installflash-attn.Many thanks again for all your help @tdejager! :)