Tensorflow DLC 2.0 ImportError: DLL load failed: The specified module could not be found

Windows 10
CUDA 9.0
GeForce 1080 Ti
cudnn 7.3.1.20
Driver 385.54
Microsoft visual 2012, 2013 and 2015
Python 3.6
Tensorflow 1.8
These are the same specs I have on another computer where DLC works just fine.

Followed instruction for DeepLabCut 2.0 installation (here https://github.com/AlexEMG/DeepLabCut/blob/master/docs/installation.md)

When following the instructions in step four of the tensorflow installation, I open the ipython session and type “import tensorflow as tf”. I then get the following error.

Capture2
I tried uninstalling and reinstalling numpy, but that didn’t work. I appreciate any help anyone can provide! Thanks!

I wasn’t using DLC 2.0, but I battled a very similar error recently. This thread helped me resolve it: https://github.com/ContinuumIO/anaconda-issues/issues/1508

There’s a lot of stuff in there that may not help at all, but in my case the issue was another application had put an unwelcome dll in System32. When I uninstalled the culprit everything started to work again.

1 Like

I recommend using the supplied Anaconda Env, this fixes (most) errors that occur like this.

EDITED to add: this also did not work on a freshly installed Windows machine), so please see the solutions below. I would still use the supplied env but be sure to adjust the PATH.

1 Like

Unfortunately, creating an environment from the provided file gave the same error when importing tensorflow. I’m still working through the thread that @petebankhead recommended to see if there is a fix there.

1 Like

EDIT
The solution in this post seems to be a onetime fix, I tried importing tensorflow again after closing anaconda prompt and got the error again. The next solution I found (full post below), is just run “conda install msvc_runtime” in the deeplabcut environment. This seems to work and I was able to import tensorflow and deeplabcut.

Original post
SOLUTION: on this GitHub post https://github.com/ContinuumIO/anaconda-issues/issues/1508 from user indramal. Basically needed to copy the path for a .libs folder in the environment into the PATH.
Copied
D:\Anaconda\envs\dlc-windowsGPU\Lib\site-packages\numpy.libs
Command line into Anaconda prompt dlc environment
PATH=D:\Anaconda\envs\dlc-windowsGPU\Lib\site-packages\numpy.libs;%PATH%
I was then able to import tensorflow and confirm that the GPU was engaged.

3 Likes

Funny enough, I had the same issue while trying to install DLC on a new Windows machine on just now. I have never run into this in the past, and I actually didn’t get this solution to work yet. But I’ll try again (I typically only use Ubuntu!)

3 Likes

It actually works!
Tensorflow finally imported. Thank you very much.

1 Like

So I’ve actually hit the exact same error now when trying to “import deeplabcut”. It seems that that fix wasn’t universal. I’m working on it but if you find a different solution, I would love to know!

Let me know whatever you find E-Edwards, I am also stuck with import deeplabcut

It seems like the previous solution was a one time fix, because I tried importing tensorflow again got the error again. The next solution I found came from here https://stackoverflow.com/questions/36778066/importerror-dll-load-failed-when-importing-numpy-installed-in-conda-virtual-env
from user “cfh”. In the virtual environment run

conda install msvc_runtime

I’ve run through the importing of tensorflow and deeplabcut a few time and this seems to work. I’m not an expert though, so I don’t know if this will conflict with anything else in deeplabcut. Hopefully this is a more permanent fix.

3 Likes

other resources: https://github.com/tensorflow/tensorflow/issues/22794#issuecomment-441431361

In case somebody else is still experiencing this problem: there seems to have been a faulty python patch recently (https://github.com/ContinuumIO/anaconda-issues/issues/10628 )

conda install python=3.6.8=h9f7ef89_0

solved it for me.

2 Likes

I had a same problem but I fixed it
I installed CUDA 10.0 and cudNN 7.4.2 for CUDA 10.0 and it fixed problem for me
FUN FACT CUDA 10.1 did not work

2 Likes