Pytorch3d: conda install error (related to CUDA driver)/ can't import pytorch3d.loss

Created on 15 Aug 2020  Â·  5Comments  Â·  Source: facebookresearch/pytorch3d

Similar to this issues

I'm also having an installation problem, even though I have installed the dependencies, and my CUDA driver version seems to match the requirement. I've attached the error during installation and conda list output below. Could you please help me with this?

  • Error message:
$ conda install pytorch3d -c pytorch3d

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your CUDA driver:

  - feature:/linux-64::__cuda==10.2=0

Your installed CUDA driver is: 10.2
  • packages in my environment:
$ conda list
# packages in environment at /disk/ocean/yichao-liang/miniconda3/envs/pytorch3d:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main
_pytorch_select           0.1                       cpu_0
attrs                     19.3.0                     py_0
backcall                  0.2.0                      py_0
blas                      1.0                         mkl
bleach                    3.1.5                      py_0
ca-certificates           2020.6.24                     0
certifi                   2020.6.20                py37_0
cffi                      1.14.1           py37he30daa8_0
cudatoolkit               10.2.89              hfd86e86_1
dbus                      1.13.16              hb2f20db_0
decorator                 4.4.2                      py_0
defusedxml                0.6.0                      py_0
entrypoints               0.3                      py37_0
expat                     2.2.9                he6710b0_2
fontconfig                2.13.0               h9420a91_0
freetype                  2.10.2               h5ab3b9f_0
fvcore                    0.1.1.post20200716            py_0    conda-forge
glib                      2.65.0               h3eb4bd4_0
gst-plugins-base          1.14.0               hbbd80ab_1
gstreamer                 1.14.0               hb31296c_0
icu                       58.2                 he6710b0_3
importlib-metadata        1.7.0                    py37_0
importlib_metadata        1.7.0                         0
intel-openmp              2020.1                      217
ipykernel                 5.3.4            py37h5ca1d4c_0
ipython                   7.17.0           py37h39e3cac_0
ipython_genutils          0.2.0                    py37_0
ipywidgets                7.5.1                      py_0
jedi                      0.17.0                   py37_0
jinja2                    2.11.2                     py_0
jpeg                      9b                   h024ee3a_2
jsonschema                2.6.0                    py37_0
jupyter                   1.0.0                    py37_7
jupyter_client            6.1.6                      py_0
jupyter_console           6.1.0                      py_0
jupyter_core              4.6.3                    py37_0
lcms2                     2.11                 h396b838_0
ld_impl_linux-64          2.33.1               h53a641e_7
libedit                   3.1.20191231         h14c3975_1
libffi                    3.3                  he6710b0_2
libgcc-ng                 9.1.0                hdf63c60_0
libgfortran-ng            7.3.0                hdf63c60_0
libpng                    1.6.37               hbc83047_0
libsodium                 1.0.18               h7b6447c_0
libstdcxx-ng              9.1.0                hdf63c60_0
libtiff                   4.1.0                h2733197_1
libuuid                   1.0.3                h1bed415_2
libxcb                    1.14                 h7b6447c_0
libxml2                   2.9.10               he19cac6_1
lz4-c                     1.9.2                he6710b0_1
markupsafe                1.1.1            py37h14c3975_1
mistune                   0.8.4           py37h14c3975_1001
mkl                       2020.1                      217
mkl-service               2.3.0            py37he904b0f_0
nbconvert                 5.6.1                    py37_1
nbformat                  5.0.7                      py_0
ncurses                   6.2                  he6710b0_1
ninja                     1.10.0           py37hfd86e86_0
notebook                  6.0.3                    py37_0
numpy                     1.11.3          py37h7e9f1db_12
numpy-base                1.11.3          py37hde5b4d6_12
olefile                   0.46                       py_0
openssl                   1.1.1g               h516909a_1    conda-forge
packaging                 20.4                       py_0
pandoc                    2.10.1                        0
pandocfilters             1.4.2                    py37_1
parso                     0.8.0                      py_0
pcre                      8.44                 he6710b0_0
pexpect                   4.8.0                    py37_1
pickleshare               0.7.5                 py37_1001
pillow                    7.2.0            py37hb39fc2d_0
pip                       20.2.2                   py37_0
portalocker               2.0.0                    py37_0
prometheus_client         0.8.0                      py_0
prompt-toolkit            3.0.5                      py_0
prompt_toolkit            3.0.5                         0
ptyprocess                0.6.0                    py37_0
pycparser                 2.20                       py_2
pygments                  2.6.1                      py_0
pyparsing                 2.4.7                      py_0
pyqt                      5.9.2            py37h05f1152_2
python                    3.7.7                hcff3b4d_5
python-dateutil           2.8.1                      py_0
python_abi                3.7                     1_cp37m    conda-forge
pytorch                   1.6.0           py3.7_cuda10.2.89_cudnn7.6.5_0    pytorch
pyyaml                    5.3.1            py37h7b6447c_1
pyzmq                     19.0.1           py37he6710b0_1
qt                        5.9.7                h5867ecd_1
qtconsole                 4.7.5                      py_0
qtpy                      1.9.0                      py_0
readline                  8.0                  h7b6447c_0
send2trash                1.5.0                    py37_0
setuptools                49.6.0                   py37_0
sip                       4.19.8           py37hf484d3e_0
six                       1.15.0                     py_0
sqlite                    3.32.3               h62c20be_0
tabulate                  0.8.7                    py37_0
termcolor                 1.1.0                    py37_1
terminado                 0.8.3                    py37_0
testpath                  0.4.4                      py_0
tk                        8.6.10               hbc83047_0
torchvision               0.7.0                py37_cu102    pytorch
tornado                   6.0.4            py37h7b6447c_1
tqdm                      4.48.2                     py_0
traitlets                 4.3.3                    py37_0
wcwidth                   0.2.5                      py_0
webencodings              0.5.1                    py37_1
wheel                     0.34.2                   py37_0
widgetsnbextension        3.5.1                    py37_0
xz                        5.2.5                h7b6447c_0
yacs                      0.1.6                      py_0    conda-forge
yaml                      0.2.5                h7b6447c_0
zeromq                    4.3.2                he6710b0_2
zipp                      3.1.0                      py_0
zlib                      1.2.11               h7b6447c_3
zstd                      1.4.5                h9ceee32_0
installation

Most helpful comment

On the other hand, installing with pip install pytorch3d would work fine at first, but I can't import the package properly in python.

Here is what I mean (after installing with pip):

$ python
Python 3.7.7 (default, May  7 2020, 21:25:33)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch3d.loss
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/loss/__init__.py", line 4, in <module>
    from .chamfer import chamfer_distance
  File "/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/loss/chamfer.py", line 7, in <module>
    from pytorch3d.ops.knn import knn_gather, knn_points
  File "/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/ops/__init__.py", line 5, in <module>
    from .graph_conv import GraphConv
  File "/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/ops/graph_conv.py", line 8, in <module>
    from pytorch3d import _C
ImportError: cannot import name '_C' from 'pytorch3d' (/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/__init__.py)

All 5 comments

On the other hand, installing with pip install pytorch3d would work fine at first, but I can't import the package properly in python.

Here is what I mean (after installing with pip):

$ python
Python 3.7.7 (default, May  7 2020, 21:25:33)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch3d.loss
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/loss/__init__.py", line 4, in <module>
    from .chamfer import chamfer_distance
  File "/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/loss/chamfer.py", line 7, in <module>
    from pytorch3d.ops.knn import knn_gather, knn_points
  File "/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/ops/__init__.py", line 5, in <module>
    from .graph_conv import GraphConv
  File "/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/ops/graph_conv.py", line 8, in <module>
    from pytorch3d import _C
ImportError: cannot import name '_C' from 'pytorch3d' (/afs/inf.ed.ac.uk/group/ug4-projects/s1735938/pytorch3d/pytorch3d/__init__.py)

After a bit more experiments, this is what happens if I'm starting all the way from creating a new environment, as described in install.md:

$ python
Python 3.8.5 (default, Aug  5 2020, 08:36:46)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch3d
>>> from pytorch3d.io import load_obj
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/disk/ocean/yichao-liang/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/io/__init__.py", line 4, in <module>
    from .obj_io import load_obj, load_objs_as_meshes, save_obj
  File "/disk/ocean/yichao-liang/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/io/obj_io.py", line 15, in <module>
    from pytorch3d.structures import Meshes, Textures, join_meshes_as_batch
  File "/disk/ocean/yichao-liang/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/structures/__init__.py", line 4, in <module>
    from .pointclouds import Pointclouds
  File "/disk/ocean/yichao-liang/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/structures/pointclouds.py", line 5, in <module>
    from .. import ops
  File "/disk/ocean/yichao-liang/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/ops/__init__.py", line 5, in <module>
    from .graph_conv import GraphConv
  File "/disk/ocean/yichao-liang/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/ops/graph_conv.py", line 6, in <module>
    from pytorch3d import _C
ImportError: /disk/ocean/yichao-liang/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/_C.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceISt7complexIfEEEPKNS_6detail12TypeMetaDataEv
>>> from pytorch3d.structures import Meshes
Segmentation fault

I experienced the same problem as the main author. (cuda

(base) ➜ ~ conda install pytorch3d -c pytorch3d
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed

UnsatisfiableError: The following specifications were found to be incompatible with each other:

Output in format: Requested package -> Available versionsThe following specifications were found to be incompatible with your system:

  • feature:/linux-64::__cuda==10.2=0
  • feature:|@/linux-64::__cuda==10.2=0

Your installed version is: 10.2

(base) ➜ ~ python
Python 3.7.4 (default, Aug 13 2019, 20:35:49)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.

import torch
i>>> import torchvision
torch.__version__
'1.6.0'
torchvision.__version__
'0.7.0'
torch.version.cuda
'10.2'

The most recent release of PyTorch3D was before the most recent version of pytorch, 1.6.0, which you have in your environment, was released. PyTorch3D will only work if it is built with the same version of pytorch as the one you have. If you try to install using conda all the dependencies are tracked and the command will correctly fail. If you try using pip you will end up with a package which doesn't work.

The easiest solution is to remove the pip package and install a nightly build of pytorch3d instead, using conda install pytorch3d -c pytorch3d-nightly.

The most recent release of PyTorch3D was before the most recent version of pytorch, 1.6.0, which you have in your environment, was released. PyTorch3D will only work if it is built with the same version of pytorch as the one you have. If you try to install using conda all the dependencies are tracked and the command will correctly fail. If you try using pip you will end up with a package which doesn't work.

The easiest solution is to remove the pip package and install a nightly build of pytorch3d instead, using conda install pytorch3d -c pytorch3d-nightly.

To me, installing pytorch3d-nightly works! Thank you very much for the tip!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

farhanrw picture farhanrw  Â·  3Comments

OmriKaduri picture OmriKaduri  Â·  3Comments

NotAnyMike picture NotAnyMike  Â·  3Comments

shersoni610 picture shersoni610  Â·  3Comments

MarkTension picture MarkTension  Â·  3Comments