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

import error #33

Closed
amiltonwong opened this issue Feb 8, 2020 · 14 comments
Closed

import error #33

amiltonwong opened this issue Feb 8, 2020 · 14 comments
Labels
bug Something isn't working

Comments

@amiltonwong
Copy link

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
Copy link
Contributor

Does it work if you import pytorch3d before importing _C?

import pytorch3d
from pytorch3d import _C

@nikhilaravi
Copy link
Contributor

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

@amiltonwong
Copy link
Author

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
Copy link
Contributor

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

@bottler
Copy link
Contributor

bottler commented Feb 9, 2020

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

@nikhilaravi nikhilaravi added the bug Something isn't working label Feb 10, 2020
@amiltonwong
Copy link
Author

@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
Copy link

Frank-Dz commented Oct 4, 2020

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:

  • python 3.6
  • pytorch 1.16
  • cuda 10.2
  • Ubuntu 16

I have confirmed that

import pytorch

has been added in front of the

from  pytorch3d import _C

image

Thank you in advance!

@bottler
Copy link
Contributor

bottler commented Oct 4, 2020

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

@mengxiangxiang414
Copy link

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

@mengxiangxiang414
Copy link

mengxiangxiang414 commented Dec 11, 2020

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

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

My pip list is:

  • addict 2.4.0
  • aiocontextvars 0.2.2
  • alfred-py 2.8.3
  • argon2-cffi 20.1.0
  • async-generator 1.10
  • attrs 20.3.0
  • backcall 0.2.0
  • bleach 3.2.1
  • certifi 2020.12.5
  • cffi 1.14.4
  • chardet 3.0.4
  • colorama 0.4.4
  • contextvars 2.4
  • cycler 0.10.0
  • dataclasses 0.8
  • decorator 4.4.2
  • defusedxml 0.6.0
  • Deprecated 1.2.10
  • entrypoints 0.3
  • funcy 1.15
  • future 0.18.2
  • fvcore 0.1.2.post20201210
  • idna 2.10
  • imageio 2.9.0
  • immutables 0.14
  • importlib-metadata 3.1.1
  • ipykernel 5.3.4
  • ipython 7.16.1
  • ipython-genutils 0.2.0
  • ipywidgets 7.5.1
  • jedi 0.17.2
  • Jinja2 2.11.2
  • joblib 0.17.0
  • jsonschema 3.2.0
  • jupyter-client 6.1.7
  • jupyter-core 4.7.0
  • jupyterlab-pygments 0.1.2
  • kiwisolver 1.3.1
  • loguru 0.5.3
  • lxml 4.6.2
  • MarkupSafe 1.1.1
  • matplotlib 3.3.3
  • mistune 0.8.4
  • nbclient 0.5.1
  • nbconvert 6.0.7
  • nbformat 5.0.8
  • nest-asyncio 1.4.3
  • networkx 2.5
  • notebook 6.1.5
  • numpy 1.19.4
  • open3d 0.8.0.0
  • opencv-python 4.4.0.46
  • packaging 20.7
  • pandas 1.1.5
  • pandocfilters 1.4.3
  • parso 0.7.1
  • pexpect 4.8.0
  • pickleshare 0.7.5
  • Pillow 8.0.1
  • pip 20.3.1
  • plotly 4.14.0
  • plyfile 0.7.2
  • portalocker 2.0.0
  • prometheus-client 0.9.0
  • prompt-toolkit 3.0.8
  • ptyprocess 0.6.0
  • pycparser 2.20
  • Pygments 2.7.3
  • pyparsing 2.4.7
  • pyquaternion 0.9.9
  • pyrsistent 0.17.3
  • python-dateutil 2.8.1
  • pytorch3d 0.3.0 /home/mxx/pytorch3d
  • pytz 2020.4
  • PyWavelets 1.1.1
  • PyYAML 5.3.1
  • pyzmq 20.0.0
  • regex 2020.11.13
  • requests 2.25.0
  • retrying 1.3.3
  • scikit-image 0.17.2
  • scikit-learn 0.23.2
  • scipy 1.5.4
  • Send2Trash 1.5.0
  • setuptools 51.0.0.post20201207
  • six 1.15.0
  • sklearn 0.0
  • tabulate 0.8.7
  • termcolor 1.1.0
  • terminado 0.9.1
  • testpath 0.4.4
  • threadpoolctl 2.1.0
  • tifffile 2020.9.3
  • torch 1.6.0+cu92
  • torchvision 0.7.0+cu92
  • tornado 6.1
  • tqdm 4.54.1
  • traitlets 4.3.3
  • typing-extensions 3.7.4.3
  • urllib3 1.26.2
  • wcwidth 0.2.5
  • webencodings 0.5.1
  • wheel 0.36.1
  • widgetsnbextension 3.5.1
  • wrapt 1.12.1
  • yacs 0.1.8
  • zipp 3.4.0

my sys setting is :

  • Ubuntu16
  • cuda9.2

@bottler
Copy link
Contributor

bottler commented Dec 11, 2020

@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
Copy link

mengxiangxiang414 commented Dec 11, 2020

@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 :

I ignored the

CUB library

i retryed installing it without the

rm -rf build/ **/*.so

It was my mistake.

@aradhyamathur
Copy link

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
Copy link
Contributor

bottler commented Jul 1, 2021

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

@facebookresearch facebookresearch locked as resolved and limited conversation to collaborators Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants