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

ImportError: DLL load failed: The specified procedure could not be found. #71

Closed
ethansu1992 opened this issue Feb 19, 2020 · 10 comments
Closed
Assignees
Labels
question Further information is requested

Comments

@ethansu1992
Copy link

Hi i have this issue when i am trying to run the tutorial.

(aienv) C:\Users\Desktop\AIrendering>C:/Users/AppData/Local/Continuum/anaconda3/envs/aienv/python.exe c:/Users/Desktop/AIrendering/meshing.py
Traceback (most recent call last):
File "c:/Users/Desktop/AIrendering/meshing.py", line 8, in
from pytorch3d.io import load_objs_as_meshes
File "c:\Users\Desktop\AIrendering\pytorch3d\io_init_.py", line 4, in
from .obj_io import load_obj, load_objs_as_meshes, save_obj
File "c:\Users\Desktop\AIrendering\pytorch3d\io\obj_io.py", line 16, in
from pytorch3d.structures import Meshes, Textures, join_meshes
File "c:\Users\Desktop\AIrendering\pytorch3d\structures_init_.py", line 3, in
from .meshes import Meshes, join_meshes
File "c:\Users\Desktop\pytorch3d\structures\meshes.py", line 7, in
from pytorch3d import _C
ImportError: DLL load failed: The specified procedure could not be found.

What can i do to overcome this problem?

@bottler
Copy link
Contributor

bottler commented Feb 19, 2020

How have you installed pytorch3d? The library must be built before it can be used (it is not pure python). It does not yet build straightforwardly on Windows.

@ethansu1992
Copy link
Author

Hi bottler, i have installed pytorch3d:

(base) C:\Users\ethansu>conda activate aienv

(aienv) C:\Users\ethansu>python
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import pytorch3d

hence i am not sure why its still not working. Thank you so much for your help

@bottler
Copy link
Contributor

bottler commented Feb 19, 2020

Like I asked. How have you installed it? import pytorch3d working only shows that it can find the python source files, not that it has been built or installed.

@ethansu1992
Copy link
Author

Apologies for misunderstanding your question. After i have clone from Github
The next step that i did was:
python setup.py build --build-base=/path/to/pytorch3d
(pytorch3d) C:\Users\ethansu\pytorch3d>python setup.py install

@bottler
Copy link
Contributor

bottler commented Feb 20, 2020

That looks like you're running in a conda environment called pytorch3d not aienv, but I'm thinking you've tried the same thing more than once. I don't think those commands will have run successfully unless you've modified the code, because we know the library doesn't build properly on windows yet. (See for example PR #9)

The build should have created a file with a long name called something like _C.cpython...pyd . If you are have GPU support enabled it should be several megabytes in size. The install should have copied it (possibly with a slight rename) to somewhere in <your conda env>/lib/python3.6/site-packages/pytorch3d. Can you check this?

One thing to think of is that even if the build fails and the install fails, the command import pytorch3d in python will succeed if you are running in the directory of your checkout; however you will get errors about _C being missing if you try to use some pytorch3d functionality. But the error DLL load failed: The specified procedure could not be found suggests more that the DLL (i.e. the pyd file) exists but does not have the PyInit__C symbol defined, which is strange.

@nikhilaravi nikhilaravi added the question Further information is requested label Feb 24, 2020
@nikhilaravi nikhilaravi self-assigned this Feb 24, 2020
@ethansu1992
Copy link
Author

I have tried to search for _C.cpython...pyd and i have found the file in \Lib\site-packages\pytorch3d-0.1-py3.6-win-amd64.egg\pytorch3d_C.cp36-win_amd64.pyd Is this the file you are mentioning?

Do you think re-creating a new environment and rebuilding would be a better solution?

@bottler
Copy link
Contributor

bottler commented Feb 26, 2020

Yes, that sounds like the right file. I hope it is about a megabyte in size or larger. I haven't experimented enough with the windows build to know how it might go wrong. Yes, it might be useful to start again in a new environment.

As a next step, I would be tempted to open up that file pytorch3d_C.cp36-win_amd64.pydin dependency walker (depends.exe) or similar to get an idea of what its interface is like. Does it have any weird dependencies? Does it export PyInit__C? (I would expect you to see warnings that it depends on some python DLL which it cannot find. As long as it is the right python version this doesn't matter).

@nikhilaravi
Copy link
Contributor

@ethansu1992 I'm closing this issue. Feel free to reopen it if you are still experiencing problems.

@steezy18
Copy link

Hello, please I ran into this error while I was trying to preprocess the Shapenet dataset. I had it working all along until I re-installed the Pytorch GPU in the Anaconda environment. I will appreciate any help please. I had tried the above suggestion but not working.

(pytorch3d) C:\meshrcnn>python tools/preprocess_shapenet.py --r2n2_dir C:\meshrcnn\datasets\shapenet\ShapeNetRendering --shapenet_dir C:\meshrcnn\datasets\shapenet\ShapeNetCore_v1 --shapenet_binvox_dir C:\meshrcnn\datasets\shapenet\ShapeNetCore.v1.binvox --splits_file C:\meshrcnn\datasets\shapenet\pix2mesh_splits_val05.json --output_dir ./datasets/shapenet/ShapeNetV1processed --zip_output
Traceback (most recent call last):
File "C:\meshrcnn\tools\preprocess_shapenet.py", line 12, in
from pytorch3d.io import load_obj
File "C:\ProgramData\Anaconda3\envs\pytorch3d\lib\site-packages\pytorch3d\io_init_.py", line 8, in
from .obj_io import load_obj, load_objs_as_meshes, save_obj
File "C:\ProgramData\Anaconda3\envs\pytorch3d\lib\site-packages\pytorch3d\io\obj_io.py", line 22, in
from pytorch3d.renderer import TexturesAtlas, TexturesUV
File "C:\ProgramData\Anaconda3\envs\pytorch3d\lib\site-packages\pytorch3d\renderer_init_.py", line 7, in
from .blending import (
File "C:\ProgramData\Anaconda3\envs\pytorch3d\lib\site-packages\pytorch3d\renderer\blending.py", line 11, in
from pytorch3d import _C
ImportError: DLL load failed while importing _C: The specified procedure could not be found.

(pytorch3d) C:\meshrcnn>python tools/preprocess_shapenet.py --output_dir ./datasets/shapenet/ShapeNetprocessed --zip_output
Traceback (most recent call last):
File "C:\meshrcnn\tools\preprocess_shapenet.py", line 12, in
from pytorch3d.io import load_obj
File "C:\ProgramData\Anaconda3\envs\pytorch3d\lib\site-packages\pytorch3d\io_init_.py", line 8, in
from .obj_io import load_obj, load_objs_as_meshes, save_obj
File "C:\ProgramData\Anaconda3\envs\pytorch3d\lib\site-packages\pytorch3d\io\obj_io.py", line 22, in
from pytorch3d.renderer import TexturesAtlas, TexturesUV
File "C:\ProgramData\Anaconda3\envs\pytorch3d\lib\site-packages\pytorch3d\renderer_init_.py", line 7, in
from .blending import (
File "C:\ProgramData\Anaconda3\envs\pytorch3d\lib\site-packages\pytorch3d\renderer\blending.py", line 11, in
from pytorch3d import _C
ImportError: DLL load failed while importing _C: The specified procedure could not be found.

@bottler
Copy link
Contributor

bottler commented Apr 11, 2022

@steezy18 Please open a new issue if you want us to help, giving all the details of how you installed. This issue was resolved more than two years ago.

@facebookresearch facebookresearch locked as resolved and limited conversation to collaborators Apr 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants