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

Installation error under LINUX #1831

Open
Razbolt opened this issue Jul 8, 2024 · 8 comments
Open

Installation error under LINUX #1831

Razbolt opened this issue Jul 8, 2024 · 8 comments

Comments

@Razbolt
Copy link

Razbolt commented Jul 8, 2024

Hi guys,
I am trying to install PyTorch3d; however, I received an error that prevented me from understanding the reasoning. I shared the logs in the attached image.
Basically, I'm trying to follow the codes, and it gives me an error like No module named 'torch', which I uploaded already.
I wonder if I am the only one who had the error under the Linux system.

I hope the question is clear.

Screenshot 2024-07-08 at 18 13 36
@bottler
Copy link
Contributor

bottler commented Jul 8, 2024

PyTorch is not installed in the environment in which you are installing pytorch3d. Can you share exactly the sequence of commands you are running?

@Dead-Hand
Copy link

I encountered the same issue a few minutes ago. Running python3.12 in a virtual environment with the following torch libraries installed (verified via pip list):

  • torch 2.3.1
  • torchvision 0.18.1
  • torchaudio 2.3.1

I then follow the instructions provided in the INSTALL.md for this repo. Specifically the following:
git clone https://github.com/facebookresearch/pytorch3d.git && cd pytorch3d && pip install -e .

At which point I encounter the exact same issue as @Razbolt shows in his screenshot above.

So the "problem" for me was that I was doing this in python 3.12, and python 3.12 is not supported by pytorch3d yet. Just pointing this out in case someone else gets this issue and is trying to debug.

@bottler
Copy link
Contributor

bottler commented Jul 9, 2024

@Dead-Hand This is surprising. Python 3.12 should be fine. You should be able to run python -c "import torch" successfully before the pytorch3d install, and you then shouldn't get a "no module named torch" error from pytorch3d.

@ColinKohler
Copy link

Having the same issue as @Dead-Hand but on python 3.10 in a virtual env.

  • torch 2.3.1
  • torchvision 0.18.1

Can run python -c "import torch" successfully but get the same error as @Razbolt when attempting to install via pip install -e .

Happy to provide more information if it helps!

@bottler
Copy link
Contributor

bottler commented Jul 10, 2024

Could it be the wrong pip? Can you try python -m pip install -e . instead of pip install -e .?

@ColinKohler
Copy link

Its def. related to pip in some manner. python -m pip install -e . throws the same error but compiling manually w/o pip seems to work, i.e. python setup.py install.

@Ryuukeisyou
Copy link

Same here. Only python setup.py install work. I am using wsl and I also have to mannually set MAX_JOBS otherwise the compiler will be killed.

@nbubis
Copy link

nbubis commented Sep 4, 2024

Same issue here on Ubuntu 24.04. Install works with python 3.8 in clean virtual environment:

$ python3.8 -m venv .venv
$ source .venv/bin/activate
$ pip install torch==2.3.1
$ pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"

However, creating a new virtual environment with python 3.12 or 3.11 and running the same install leads to:

$ python3.11 -m venv .venv
$ source .venv/bin/activate
$ pip install torch==2.3.1
$ pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"

Collecting git+https://github.com/facebookresearch/pytorch3d.git@stable
  Cloning https://github.com/facebookresearch/pytorch3d.git (to revision stable) to /tmp/pip-req-build-zrn2yvub
  Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/pytorch3d.git /tmp/pip-req-build-zrn2yvub
  Running command git checkout -q 89653419d0973396f3eff1a381ba09a07fffc2ed
  Resolved https://github.com/facebookresearch/pytorch3d.git to commit 89653419d0973396f3eff1a381ba09a07fffc2ed
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "/tmp/test_pytorch3d/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/tmp/test_pytorch3d/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/test_pytorch3d/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ntt0l37_/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-ntt0l37_/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-ntt0l37_/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 503, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-ntt0l37_/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
        File "<string>", line 15, in <module>
      ModuleNotFoundError: No module named 'torch'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel 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.

Needless to say, import torch works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants