Solve “ImportError: DLL load failed” [Keras, Tensorflow]

Spread the word!

If you are a Python programmer dealing with Keras, you could face – sooner or later – this kind of problem after installing some packages. That’s exactly the problem. Not every combination of Python – Keras – Tensorflow version is possible!

First check what versions do you have, by entering one of the following commands in your Anaconda terminal (after activating your target conda environment):

  • either just conda list to display a list of all packages in the current environment and manually search for python, keras and tensorflow packages
  • or directly extracting the informations with this (which works Linux; if you want to use it in Windows, install Cygwin first and add the bin folder – e.g. C:\cygwin64\bin – to the PATH variable): conda list | grep -e python -e tensorflow -e keras

In my case it yields:

Now we can check here, to read a list possible combinations.

To know what of versions is possible to install for a given package, just enter conda search PACKAGE_NAME  (instead of PACKAGE_NAME put in this case Python, Keras or TensorFlow if you want to check what versions are possible)

You can than play and install any version of the package by conda install PACKAGE_NAME=PACKAGE_VERSION

WHAT IF IT DOES NOT WORK?

Assuming you cannot find the right combinations, enter this command in your Anaconda Terminal:

And try again to load your libraries.

IF THIS STILL DOES NOT WORK…

Try something like:

LAST BUT NOT LEAST – CONDA REVISIONS

If you want to revert all the changes, you can use a previous revision of conda, just before installing those packages giving you this problem.

Enter conda list --revisions to see all of the changes history of your current environment. If you know what’s the old revision to use, just enter conda install --revision 21

———————————————————————-

Did you face the same issue and you solved it somehow? Please write a comment to share your solution!

 

 

Be the first to comment

Leave a Reply

Your email address will not be published.


*