Error loading caffe2_detectron_ops.dll when importing torch in IDE
Pytorch GPU did work for me, but after reinstalling anaconda I got this error:
Error loading “caffe2_detectron_ops.dll” (when installing the cpu version) or
Error loading “caffe2_detectron_ops_gpu.dll” (when installing the gpu version)
This error appears already when importing torch in spyder IDE.
Total error message: &quot;OSError: [WinError 182] The operating system cannot run %1. Error loading &quot;C:\Users\konin\anaconda3\envs\pytorch_env\lib\site-packages\torch\lib\caffe2_detectron_ops.dll&quot; or one of its dependencies.&quot;
Simply deleting “caffe2_detectron_ops.dll” will give me a new error: Error loading “caffe2_module_test_dynamic.dll”, then error loading “caffe2_observers.dll”, …
Deleting all of them didn’t solve my problem, it ended up with error “ImportError: DLL load failed while importing _C”. I’m working in a conda environment (python 3.9.7), and starting new environments give the same errors. CPU or GPU download of pytorch won’t make a difference. Installing intel-openmp didn’t fix it. Reinstalling torch didn't help.
I've done everything I could find about this error message. It is actually working when using the CMD prompt, but not when running the file in spyder.
Any suggestion would be really appreciated, thanks

Btw, for everyone curious, got it solved by resetting all of my enviroments, and  setting up my environments more cleanly. Probably this conda environment got corrupted by my base environment files.
