Code Monkey home page Code Monkey logo

Comments (14)

bottler avatar bottler commented on July 24, 2024 3

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

from pytorch3d.

amiltonwong avatar amiltonwong commented on July 24, 2024 2

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

from pytorch3d.

amiltonwong avatar amiltonwong commented on July 24, 2024 1

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

from pytorch3d.

jcjohnson avatar jcjohnson commented on July 24, 2024

Does it work if you import pytorch3d before importing _C?

import pytorch3d
from pytorch3d import _C

from pytorch3d.

nikhilaravi avatar nikhilaravi commented on July 24, 2024

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

from pytorch3d.

nikhilaravi avatar nikhilaravi commented on July 24, 2024

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

from pytorch3d.

Frank-Dz avatar Frank-Dz commented on July 24, 2024

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!

from pytorch3d.

bottler avatar bottler commented on July 24, 2024

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

from pytorch3d.

mengxiangxiang414 avatar mengxiangxiang414 commented on July 24, 2024

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

from pytorch3d.

mengxiangxiang414 avatar mengxiangxiang414 commented on July 24, 2024

@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

from pytorch3d.

bottler avatar bottler commented on July 24, 2024

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

from pytorch3d.

mengxiangxiang414 avatar mengxiangxiang414 commented on July 24, 2024

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

from pytorch3d.

aradhyamathur avatar aradhyamathur commented on July 24, 2024

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

from pytorch3d.

bottler avatar bottler commented on July 24, 2024

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

from pytorch3d.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.