You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to install pytorch3d in a docker container with pip, following this. Even though pytorch is installed i get this error :
ubuntu@9b041f0efe80:~$ python
Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>>
ubuntu@9b041f0efe80:~$ pip install "git+https://github.com/facebookresearch/pytorch3d.git"
Collecting git+https://github.com/facebookresearch/pytorch3d.git
Cloning https://github.com/facebookresearch/pytorch3d.git to /tmp/pip-req-build-v2gs3l_2
Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/pytorch3d.git /tmp/pip-req-build-v2gs3l_2
Resolved https://github.com/facebookresearch/pytorch3d.git to commit 8ed0c7a00200df5ca08385b0f7c186b155175756
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 "/home/ubuntu/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/ubuntu/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ubuntu/venv/lib/python3.12/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-nepqkwa0/overlay/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 "/tmp/pip-build-env-nepqkwa0/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-nepqkwa0/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 503, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-nepqkwa0/overlay/lib/python3.12/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.
Instructions To Reproduce the Issue:
Dockerfile:
FROM nvcr.io/nvidia/cuda:12.5.1-devel-ubuntu24.04
# Update apt and install necessary packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev \
libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
tk-dev libffi-dev liblzma-dev git software-properties-common \
openssh-client sudo unzip apt-transport-https tmux
# Install Python
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y python3.12 python3.12-venv python3-pip
# Switch to the non-root user
RUN echo "ubuntu ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER ubuntu
WORKDIR /home/ubuntu
# Create and activate a virtual environment
RUN python3.12 -m venv /home/ubuntu/venv
ENV PATH="/home/ubuntu/venv/bin:$PATH"
# Upgrade pip in the virtual environment
RUN pip install --upgrade pip
# Install Python packages
RUN pip install torch torchvision
RUN pip install -U iopath
ENTRYPOINT ["bash"]
Then you can build and run with :
docker build -t pytorch3d .
docker run --gpus all -it pytorch3d
And then try to install pytorch3d inside the container :
You can clone locally and then use python setup.py install for short term, but i think using setup.py is going to be more and more deprecated. The other issue with this is that you can't list pytorch3d as a dependancy in your pyproject.toml, or i didn't find how.
🐛 Bugs / Unexpected behaviors
I tried to install pytorch3d in a docker container with pip, following this. Even though pytorch is installed i get this error :
Instructions To Reproduce the Issue:
Dockerfile:
Then you can build and run with :
And then try to install pytorch3d inside the container :
The text was updated successfully, but these errors were encountered: