facebookresearch / pytorch3d

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

import error #33

Closed amiltonwong closed 4 years ago

amiltonwong commented 4 years ago

Hi, all,

I got the following import error:

>>> from pytorch3d import _C
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /data/code11/pytorch3d/pytorch3d/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZTIN3c1021AutogradMetaInterfaceE

My config is pytorch==1.4, torchvision==0.5.0, CUDA=10.0. It seems there's conflicts with the packages? Any hints to solve it?

THX!

jcjohnson commented 4 years ago

Does it work if you import pytorch3d before importing _C?

import pytorch3d
from pytorch3d import _C
nikhilaravi commented 4 years ago

Are you using the conda package or trying to install from source?

amiltonwong commented 4 years ago

Thanks @jcjohnson @nikhilaravi for your replies.

@jcjohnson , import pytorch3d This line works. But the second line from pytorch3d import _C prompts the above error.

@nikhilaravi , I install it from local clone as guided

nikhilaravi commented 4 years ago

@amiltonwong were you able to resolve this issue after installing from a local clone?

bottler commented 4 years ago

I think you may need import torch before a line like from pytorch3d import _C, which touches pytorch3d's internals, can possibly work.

amiltonwong commented 4 years ago

@nikhilaravi @bottler , Thanks a lot for your help. It's solved after installing the new updated repo. I confirmed that import torch is needed before from pytorch3d import _C as mentioned by @bottler .

Frank-Dz commented 3 years ago

hi @bottler @amiltonwong @jcjohnson @nikhilaravi @likethesky
I installed pytorch3D according to https://github.com/facebookresearch/pytorch3d/blob/master/INSTALL.md And I still get an error:

File "/userhome/pytorch3d/pytorch3d/renderer/blending.py", line 8, in <module>
from pytorch3d import _C
ImportError: cannot import name '_C'

My system setting:

I have confirmed that

import pytorch

has been added in front of the

from  pytorch3d import _C

image

Thank you in advance!

bottler commented 3 years ago

@Frank-Dz Please open a new issue and paste the output of conda list.

mengxiangxiang414 commented 3 years ago

@Frank-Dz I have the same error.Have you solved it?

mengxiangxiang414 commented 3 years ago

@bottler My error is the same as Frank-Dz's which are as follows:

My pip list is:

my sys setting is :

bottler commented 3 years ago

@mengxiangxiang414 Please always open a new issue for things like this. How did you build/install PyTorch3D. It looks like you have installed from a local checkout of the repository, but did you actually build the library successfully? And did you build it with the current environment active? Were there and errors in building? Is there a file with a name beginning with _C in /home/mxx/pytorch3d/pytorch3d or /home/mxx/pytorch3d? Best to open a new issue with a post explaining all this if it is still problematic.

NOTE for future passers-by: If you have an import error with PyTorch3D which you cannot solve, please open a new issue.

mengxiangxiang414 commented 3 years ago

@bottler OK,thanks. As you said,I have installed from a local clone of the source, but did not actually build the library successfully. Two bad actions resulted in my error :

  1. I ignored the

CUB library

  1. i retryed installing it without the

rm -rf build/ */.so

It was my mistake.

aradhyamathur commented 3 years ago

receiving the same error however when I import chamfer loss. Traceback (most recent call last): File "point2param.py", line 38, in <module> from pytorch3d.loss import chamfer_distance File "/home/aradhya/anaconda3/envs/torchenv/lib/python3.7/site-packages/pytorch3d/loss/__init__.py", line 4, in <module> from .chamfer import chamfer_distance File "/home/aradhya/anaconda3/envs/torchenv/lib/python3.7/site-packages/pytorch3d/loss/chamfer.py", line 7, in <module> from pytorch3d.ops.knn import knn_gather, knn_points File "/home/aradhya/anaconda3/envs/torchenv/lib/python3.7/site-packages/pytorch3d/ops/__init__.py", line 5, in <module> from .graph_conv import GraphConv File "/home/aradhya/anaconda3/envs/torchenv/lib/python3.7/site-packages/pytorch3d/ops/graph_conv.py", line 6, in <module> from pytorch3d import _C ImportError: /home/aradhya/anaconda3/envs/torchenv/lib/python3.7/site-packages/pytorch3d/_C.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZTIN3c1021AutogradMetaInterfaceE pytorch==1.7.1 torchvision==0.8.2
cudatoolkit=10.2 pytorch3d==0.2.0

bottler commented 3 years ago

@aradhyamathur Please open a new issue with more details of your setup and how you installed.