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

Basic Question #1919

Open
LiYan-pro opened this issue Nov 28, 2024 · 1 comment
Open

Basic Question #1919

LiYan-pro opened this issue Nov 28, 2024 · 1 comment

Comments

@LiYan-pro
Copy link

Question Description

I installed pytorch3d==0.7.7 on Windows succeed,but when I try to use it I met an intresting problem like this:

图片

If I from pytorch3d import _C it will get wrong, BUT if I 'from pytorch3d.structures import Meshes' first and then from pytorch3d import _C it will be right.

(fp) C:\Users\35964>python
Python 3.9.20 (main, Oct  3 2024, 07:38:01) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytorch3d
>>> from pytorch3d import _C
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing _C: 找不到指定的模块。
>>> from pytorch3d.structures import Meshes
>>> from pytorch3d import _C
>>> import sys
>>> sys.path
['', 'E:\\miniconda\\envs\\fp\\python39.zip', 'E:\\miniconda\\envs\\fp\\DLLs', 'E:\\miniconda\\envs\\fp\\lib', 'E:\\miniconda\\envs\\fp', 'E:\\miniconda\\envs\\fp\\lib\\site-packages', 'E:\\miniconda\\envs\\fp\\lib\\site-packages\\nvdiffrast-0.3.3-py3.9.egg', 'E:\\miniconda\\envs\\fp\\lib\\site-packages\\pytorch3d-0.7.7-py3.9-win-amd64.egg', 'E:\\miniconda\\envs\\fp\\lib\\site-packages\\setuptools\\_vendor', 'E:\\miniconda\\envs\\fp\\lib\\site-packages\\win32', 'E:\\miniconda\\envs\\fp\\lib\\site-packages\\win32\\lib', 'E:\\miniconda\\envs\\fp\\lib\\site-packages\\Pythonwin']
>>>

Does anybody know whats wrong with this?

Basic Environment

  • Windows 11
  • Visual Studio 2019 Developer Command Prompt v16.11.32
  • Cuda 11.7
  • pytorch 2.0.0
  • torchaudio 2.0.0
  • torchvision 0.15.0
  • CUB 1.17.0

PS: I'd try this method #1013 (comment), it doesn't work.

@bottler
Copy link
Contributor

bottler commented Nov 28, 2024

Yes, this has been discussed on other issues.

  1. Note that _C is a private part of pytorch3d. It is not meant to be imported directly by users. The "problem" you report is not a bug.

  2. What is going on here is that the binary extension _C will only work if certain binary components of pytorch have already been loaded. The line from pytorch3d import _C will work after import torch has been run. PyTorch3D itself should not have any files which import _C without first importing torch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants