No module named 'torch', why?
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Obtaining file:///E:/python310/GeneFacePlusPlus-main/GeneFacePlusPlus-main/pytorch3d-0.7.8/pytorch3d-0.7.8 Installing build dependencies ... done Checking if build backend supports build_editable ... done Getting requirements to build editable ... error error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
Traceback (most recent call last):
File "E:\python310\GeneFacePlusPlus-main\GeneFacePlusPlus-main\myenv\lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully. │ exit code: 1 ╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
but I do have torch installed (myenv) PS E:\python310\GeneFacePlusPlus-main\GeneFacePlusPlus-main\pytorch3d-0.7.8\pytorch3d-0.7.8> pip list | findstr /sina:c 'torch' 14:torch 2.4.1+cu124 15:torchaudio 2.4.1+cu124 16:torchvision 0.19.1+cu124
There's not enough information here to help you. What command are you running?
There's not enough information here to help you. What command are you running?
I'm not sure why, but I think you need to clone the repo and then install from the local copy. pip is trying to build the library in an isolated environment, which won't work. There are other issues where people list what they did to install on Windows.
try: pip install --upgrade setuptools wheel
Thanks @HengYuD !!!
Your suggestion worked.
try: pip install --upgrade setuptools wheel
I successfully installed on Windows 11 using Micromamba (highly recommend). I followed these setup steps specifically:
Install micromamba
Micromamba is a lightweight python package manager. Install it for windows here
Set up Environment
- Open a terminal and check that micromamba is installed by running
micromamba
- Ensure micromamba is up-to-date by running
micromamba self-update
- Create a new environment
micromamba create -n rq3 python=3.9
micromamba activate rq3
- Install pytorch3d dependencies
micromamba install pytorch=1.13.0 torchvision pytorch-cuda=11.6 -c pytorch -c nvidia
micromamba install -c iopath iopath
- Install pytorch 3d from source
pip install --upgrade setuptools wheel
pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
- Downgrade numpy (since using older version of torch)
micromamba install numpy<2
I'm not sure why, but I think you need to clone the repo and then install from the local copy. pip is trying to build the library in an isolated environment, which won't work. There are other issues where people list what they did to install on Windows.
Any plan on supporting the installation in isolated environments?
PEP 517 is almost 10 years and, for example, new buiild systems (like uv) by default follow those suggested guidelines. I'm sure that with time people will have more and more problems installing pytorch3d.
Migrating from setup.py to pyproject.toml(PEP 621) would be nice, but even in setup.py is there any reason why pytorch is not listed as an explicit dependency?
I'm not sure why, but I think you need to clone the repo and then install from the local copy. pip is trying to build the library in an isolated environment, which won't work. There are other issues where people list what they did to install on Windows.
Any plan on supporting the installation in isolated environments? PEP 517 is almost 10 years and, for example, new buiild systems (like
uv) by default follow those suggested guidelines. I'm sure that with time people will have more and more problems installingpytorch3d.Migrating from
setup.pytopyproject.toml(PEP 621) would be nice, but even insetup.pyis there any reason whypytorchis not listed as an explicit dependency?
Yes please!
I use this library heavily for research but the difficulties regarding installation are a big barrier for the reproducibility of results...
try: pip install --upgrade setuptools wheel
This worked!.
I used the local install method by cloning the repo and then running pip install -e ., I was still getting errors for "torch not installed" even though I made sure I had it installed, until I upgraded setuptools as you suggested. This needs to be added in the README.md
After trying to re-install again, I just gave up and decided I need to use something else. I agree with @ZamboniMarco99, please either switch to pyproject.toml or fix setup.py.
尝试:pip install --upgrade setuptools wheel
Tanks, its worked,
add --no-build-isolation