How I solved — Tensorflow Import Error in Anaconda IDE

amit ray
2 min readJan 1, 2021

I was frustrated seeing the error “from tensorflow.python._pywrap_tensorflow_internal import *ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.”

I googled a lot to find a solution and finally I thought may be my PC lacks some hardware. Some people suggested to install Redistributable VC++ latest version. I did that but still it didnt work. I installed Anaconda in another PC with a higher configuration but still I was getting that same error, whenever I was trying to import Tensorflow.

I was about to give up when I found a post where I saw that we can install tensorflow not only using command line “pip install tensorflow” but also using Anaconda navigator. A more better way to install extensions.

I came across this post https://docs.anaconda.com/anaconda/user-guide/tasks/tensorflow/ where it mentions to create a Tensorflow environment and then activate it. But I used the navigator method instead as that solution didnt work for me.

Creating Environement using Anaconda Navigator

You can see that we have created an Environment and named it “tf”. Now our task is to install tensorflow module in the “tf” environment using navigator.

Installing Tensorflow using Navigator

Still it will give the same error if you open the default Spyder(Anaconda 3) menu from your programs menu. You need to create a new spyder menu for the new environment.

I have created a test Environment to show how you can get a new Spyder menu.

You have to install spyder after selecting your new cretated environment from the Applications On dropdown menu.

After installing you will be able to see your newly created spyder menu.

My Environment was named “tf” so its showing Spyder(tf). Once I click on that and open Anaconda IDE, I dont get that Tensorflow import error anymore. Hope this will help people who come across this error. I couldnt find any solution anywhere. So I am listing it here so that you should not go through same mental torture.

--

--

amit ray
0 Followers

I am a Chemical Engineer currently working in Chennai. I have interest in Machine Learning and Robotics. My Aim is to develop a robot with human emotions.