facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.76k stars 1.31k forks source link

Install PyTorch3D on windows 10 #1546

Closed rezalahmi closed 1 year ago

rezalahmi commented 1 year ago

Description: I encountered an issue while trying to install PyTorch3D from source on Windows. Here is the current status of my environment:

conda list:

Name Version Build Channel ca-certificates 2023.01.10 haa95532_0
charset-normalizer 2.0.4 pyhd3eb1b0_0
cuda-cccl 12.1.109 0 nvidia cuda-cudart 11.7.99 0 nvidia cuda-cudart-dev 11.7.99 0 nvidia cuda-cupti 11.7.101 0 nvidia cuda-libraries 11.7.1 0 nvidia cuda-libraries-dev 11.7.1 0 nvidia cuda-nvrtc 11.7.99 0 nvidia cuda-nvrtc-dev 11.7.99 0 nvidia cuda-nvtx 11.7.91 0 nvidia cuda-runtime 11.7.1 0 nvidia intel-openmp 2023.1.0 h59b6b97_46319
libcublas-dev 11.10.3.66 0 nvidia libcufft-dev 10.7.2.124 0 nvidia libcurand-dev 10.3.2.106 0 nvidia libcusolver-dev 11.4.0.1 0 nvidia libcusparse-dev 11.7.4.91 0 nvidia libnpp-dev 11.7.4.75 0 nvidia libnvjpeg-dev 11.8.0.2 0 nvidia libwebp-base 1.2.4 h2bbff1b_1
lz4-c 1.9.4 h2bbff1b_0
mkl-service 2.4.0 py38h2bbff1b_1
numpy-base 1.24.3 py38h8a87ada_1
pytorch-cuda 11.7 h16d0643_5 pytorch pytorch-mutex 1.0 cuda pytorch

pip list: Package Version brotlipy 0.7.0 certifi 2023.5.7 cffi 1.15.1 charset-normalizer 2.0.4 cryptography 39.0.1 fvcore 0.1.5.post20221221 idna 3.4 iopath 0.1.10 mkl-fft 1.3.6 mkl-random 1.2.2 mkl-service 2.4.0 numpy 1.24.3 Pillow 9.4.0 pip 23.0.1 portalocker 2.7.0 pycparser 2.21 pyOpenSSL 23.0.0 PySocks 1.7.1 pytorch3d 0.7.4 PyYAML 6.0 requests 2.29.0 setuptools 66.0.0 tabulate 0.9.0 termcolor 2.3.0 torch 1.13.0 torchvision 0.14.0 tqdm 4.65.0 typing_extensions 4.5.0 urllib3 1.26.15 wheel 0.38.4 win-inet-pton 1.1.0 yacs 0.1.8

Steps Taken:

Installed PyTorch successfully, and verified the version (1.13.0) and GPU availability.

Python 3.8.16 (default, Mar  2 2023, 03:18:16) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.13.0
>>> print(torch.cuda.is_available())
True

Attempted to install PyTorch3D from source on Windows using the provided instructions. packages in environment at C:\Users\Mahoor\anaconda3\envs\project_3d:

Name Version Build Channel blas 1.0 mkl brotlipy 0.7.0 py38h2bbff1b_1003 ca-certificates 2023.01.10 haa95532_0 certifi 2023.5.7 py38haa95532_0 cffi 1.15.1 py38h2bbff1b_3 charset-normalizer 2.0.4 pyhd3eb1b0_0 cryptography 39.0.1 py38h21b164f_0 cuda-cccl 12.1.109 0 nvidia cuda-cudart 11.7.99 0 nvidia cuda-cudart-dev 11.7.99 0 nvidia cuda-cupti 11.7.101 0 nvidia cuda-libraries 11.7.1 0 nvidia cuda-libraries-dev 11.7.1 0 nvidia cuda-nvrtc 11.7.99 0 nvidia cuda-nvrtc-dev 11.7.99 0 nvidia cuda-nvtx 11.7.91 0 nvidia cuda-runtime 11.7.1 0 nvidia freetype 2.12.1 ha860e81_0 giflib 5.2.1 h8cc25b3_3 idna 3.4 py38haa95532_0 intel-openmp 2023.1.0 h59b6b97_46319 jpeg 9e h2bbff1b_1 lerc 3.0 hd77b12b_0 libcublas 11.10.3.66 0 nvidia libcublas-dev 11.10.3.66 0 nvidia libcufft 10.7.2.124 0 nvidia libcufft-dev 10.7.2.124 0 nvidia libcurand 10.3.2.106 0 nvidia libcurand-dev 10.3.2.106 0 nvidia libcusolver 11.4.0.1 0 nvidia libcusolver-dev 11.4.0.1 0 nvidia libcusparse 11.7.4.91 0 nvidia libcusparse-dev 11.7.4.91 0 nvidia libdeflate 1.17 h2bbff1b_0 libffi 3.4.4 hd77b12b_0 libnpp 11.7.4.75 0 nvidia libnpp-dev 11.7.4.75 0 nvidia libnvjpeg 11.8.0.2 0 nvidia libnvjpeg-dev 11.8.0.2 0 nvidia libpng 1.6.39 h8cc25b3_0 libtiff 4.5.0 h6c2663c_2 libuv 1.44.2 h2bbff1b_0 libwebp 1.2.4 hbc33d0d_1 libwebp-base 1.2.4 h2bbff1b_1 lz4-c 1.9.4 h2bbff1b_0 mkl 2023.1.0 h8bd8f75_46356 mkl-service 2.4.0 py38h2bbff1b_1 mkl_fft 1.3.6 py38hf11a4ad_1 mkl_random 1.2.2 py38hf11a4ad_1 numpy 1.24.3 py38h79a8e48_1 numpy-base 1.24.3 py38h8a87ada_1 openssl 1.1.1t h2bbff1b_0 pillow 9.4.0 py38hd77b12b_0 pip 23.0.1 py38haa95532_0 portalocker 2.7.0 pypi_0 pypi pycparser 2.21 pyhd3eb1b0_0 pyopenssl 23.0.0 py38haa95532_0 pysocks 1.7.1 py38haa95532_0 python 3.8.16 h6244533_3 pytorch 1.13.0 py3.8_cuda11.7_cudnn8_0 pytorch pytorch-cuda 11.7 h16d0643_5 pytorch pytorch-mutex 1.0 cuda pytorch pytorch3d 0.7.4 pypi_0 pypi pyyaml 6.0 pypi_0 pypi requests 2.29.0 py38haa95532_0 setuptools 66.0.0 py38haa95532_0 sqlite 3.41.2 h2bbff1b_0 tabulate 0.9.0 pypi_0 pypi tbb 2021.8.0 h59b6b97_0 termcolor 2.3.0 pypi_0 pypi tk 8.6.12 h2bbff1b_0 torchvision 0.14.0 pypi_0 pypi tqdm 4.65.0 pypi_0 pypi typing_extensions 4.5.0 py38haa95532_0 urllib3 1.26.15 py38haa95532_0 vc 14.2 h21ff451_1 vs2015_runtime 14.27.29016 h5e58377_2 wheel 0.38.4 py38haa95532_0 win_inet_pton 1.1.0 py38haa95532_0 xz 5.4.2 h8cc25b3_0 yacs 0.1.8 pypi_0 pypi zlib 1.2.13 h8cc25b3_0 zstd 1.5.5 hd43e919_0

and,

(project_3d) C:\Users\Mahoor\pytorch3d_git>python
Python 3.8.16 (default, Mar  2 2023, 03:18:16) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch3d
>>> print(pytorch3d.__file__)
C:\Users\Mahoor\pytorch3d_git\pytorch3d\__init__.py
>>> from pytorch3d import _C
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name '_C' from 'pytorch3d' (C:\Users\Mahoor\pytorch3d_git\pytorch3d\__init__.py)

Issue: After following the installation instructions, I encountered an issue where I am unable to import the '_C' module from PyTorch3D. The error message suggests that the import error is occurring within the init.py file of the PyTorch3D package.

Expected Outcome: I expected to be able to import and use the PyTorch3D library successfully.

Please let me know if there is any additional information or steps required to resolve this issue. Thank you for your assistance!

bottler commented 1 year ago

_C is an internal part of pytorch3d and users are not expected to want to import it on its own. In particular, even with a perfect installation it won't import cleanly. Please can you try either of the following

from pytorch3d.structures import Meshes
import torch
from pytorch3d import _C

?

If they fail with the same error, can you see if you have a _C DLL file in your C:\Users\Mahoor\pytorch3d_git\pytorch3d folder?

rezalahmi commented 1 year ago
Python 3.8.16 (default, Mar  2 2023, 03:18:16) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pytorch3d.structures import Meshes
>>> import torch
>>> from pytorch3d import _C
>>>

as you can see, it's worked. I will test my project in the future and if everything going well, I will share all configuration and instruction with you. I hope it help. Thanks for your answer.

hu394854434 commented 1 year ago

i use from pytorch3d.structures import Meshes with no erro,but import torch from pytorch3d import _C shows erro" DLL load failed while importing _C".And I have "_C.cp39-win_amd64.pyd" in my folder

bottler commented 1 year ago

@hu394854434 Then everything is fine for you! I'm closing this issue, the OP is also sorted.