7

I have torch 1.6 and python 3.8. When training OpenNMT, it throws the following error -

OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\Girish\AppData\Local\Programs\Python\Python38\lib\sitepackages\torch\lib\caffe2_detectron_ops.dll" or one of its dependencies.

I checked the folder, the file is present there. I have tried uninstalling torch and reinstalling it, but no help.

Any help will be appreciated. thanks

girishnjha
  • 81
  • 1
  • 3

6 Answers6

11

https://github.com/pytorch/pytorch/issues/35803#issuecomment-725285085

This answer worked for me.

Just deleting "caffe2_detectron_ops.dll" from the path ("C:\Users\Girish\AppData\Local\Programs\Python\Python38\lib\sitepackages\torch\lib\caffe2_detectron_ops.dll")

youngwoon
  • 363
  • 4
  • 14
1

In my case, after deleting caffe2_detectron_ops.dll, it generated the same error for caffe2_detectron_ops_gpu.dll, caffe2_module_test_dynamic.dll, caffe2_observers.dll and cublas64_11.dll.

So I followed @youngwoon's step, I deleted them all. And everything works fine now.

Honestly, this has a root cause and should be explained. But unfortunately, I can't.

odunayo12
  • 425
  • 5
  • 10
0

Try this, pip install intel-openmp.

It worked for me

  • 2
    Hi Sushmitha. The creator of this question has specifically stated that they have tried to install this package and it did not work. – jeeves Nov 12 '20 at 19:36
0

You can find missing dependencies with various tools like Dependencies which is a rewrite of old Dependency Walker.

In my case the tool pointed to missing library libiomp5md.dll.

enter image description here

Installing intel-openmp as suggested by user @sushmitha resolved the issue.

SpaceKees
  • 31
  • 3
0

delete caffe2_detectron_ops.dll file from C:\Users\ <your_user_name> \anaconda3\envs\ <your_environment> \Lib\site-packages\torch\lib

0

Same error to me, but I think that deleting the items just disable the use of GPU use, this is not what I want. I've tried, the error is gone, but the use os GPU too...

import torch
torch.cuda.is_available()

The return is False.

Reinstall torch works to me:

# pip3 install torch==1.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html --user
# pip3 install torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html --user
# pip3 install torchvision==0.11.2+cu113 torchaudio===0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html --user
ouflak
  • 2,458
  • 10
  • 44
  • 49
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 22 '22 at 18:00