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

CRITICAL:root:Cannot load caffe2.python. Error: DLL load failed: The specified module could not be found. #22859

Open
137996047 opened this issue Jul 15, 2019 · 13 comments
Labels

Comments

@137996047
Copy link

❓ Questions and Help

I'm installing into a conda env. it is on Windows 10 . No GPU on machine.
I am following instructions from https://caffe2.ai/docs/getting-started.html?platform=windows&configuration=compile

And the build is success.
image

Then I copy C:\Users\v-hadong\pytorch\build\caffe2\python\caffe2_pybind11_state.pyd to Python’s DLL folder C:\Users\v-hadong\AppData\Local\Continuum\anaconda2\envs\caffe2\DLLs\

and then the error is happened as the following picture:
image

@peterjc123
Copy link
Collaborator

You need to copy the DLLs generated by LibTorch in the lib directory, too.

@137996047
Copy link
Author

directory
Thank you for your replay, I copy C:\Users\v-hadong\pytorch\build\lib\caffe2_pybind11_state.lib to C:\Users\v-hadong\AppData\Local\Continuum\anaconda2\envs\caffe2\libs.
But it doesn't work.

@peterjc123
Copy link
Collaborator

No, I mean something like torch.dll, c10.dll.

@137996047
Copy link
Author

No, I mean something like torch.dll, c10.dll.

I copy all *.dll to C:\Users\v-hadong\AppData\Local\Continuum\anaconda2\envs\caffe2\libs ,
it doesn't work too.

@137996047
Copy link
Author

No, I mean something like torch.dll, c10.dll.

When I run the build.bat, I set BUILD_SHARED_LIBS=ON. Does this matter?

@peterjc123
Copy link
Collaborator

Yes, that means the DLLs will be used instead of a complete executable without dependencies.

@peterjc123
Copy link
Collaborator

You should copy them to C:\Users\v-hadong\AppData\Local\Continuum\anaconda2\envs\caffe2\DLLs, not libs.

@137996047
Copy link
Author

You should copy them to C:\Users\v-hadong\AppData\Local\Continuum\anaconda2\envs\caffe2\DLLs, not libs.

I copy torch.dll, c10.dll to C:\Users\v-hadong\AppData\Local\Continuum\anaconda2\envs\caffe2\DLLs, it doesn't work too.

And I use the dependencies analyse the caffe2_pybind11_state.pyd, it shows:
image

@peterjc123
Copy link
Collaborator

Would you please add C:\Users\v-hadong\AppData\Local\Continuum\anaconda2\envs\caffe2\DLLs into the environment variable PATH and try again?

@137996047
Copy link
Author

Would you please add C:\Users\v-hadong\AppData\Local\Continuum\anaconda2\envs\caffe2\DLLs into the environment variable PATH and try again?

I try do this, it doesn't work too.
And I found python 2.7 dependency is in base env not in the caffe2.
image

Then I do the same procedures as above in the base env, but it doesn't work too.

@zou3519 zou3519 added the caffe2 label Jul 16, 2019
@peterjc123
Copy link
Collaborator

You'll need to reopen a new CMD window to take that into effect.

@137996047
Copy link
Author

You'll need to reopen a new CMD window to take that into effect.

I try it, but doesn't work.

@peterjc123
Copy link
Collaborator

I've introduced some methods for dealing with dll loading problems in this post: #20408. You can have a try.

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

No branches or pull requests

3 participants