tensorflow is installed but theres an error while importing

+1 vote

I'm new at python (version of python 3.7.7) and I'm trying to run a finished project, I imported everything but tensorflow is not working the error is shown down below:

Traceback (most recent call last):   File
line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed: A dynamic link library (DLL)
initialization routine failed. During handling of the above exception,
another exception occurred: Traceback (most recent call last):   File
"C:/Users/User/Desktop/adsp/train.py", line 1, in <module>
    import tensorflow as tf   File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py",
line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util   File
line 39, in <module>
    from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow   File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 83, in <module>
    raise ImportError(msg) ImportError: Traceback (most recent call last):   File
line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed: A dynamic link library (DLL)
initialization routine failed. Failed to load the native TensorFlow
runtime. See https://www.tensorflow.org/install/errors for some common
reasons and solutions.  Include the entire stack trace above this
error message when asking for help.
Dec 22, 2020 in Python by Christian
• 130 points

edited Dec 22, 2020 by MD 13,072 views

1 answer to this question.

0 votes


This problem is related to version. Follow the below given steps.

  • Create one environment and install latest version of python.

$ conda create -n tensorflow pip python=3.6
  • Use tensorflow environment.

$ activate tensorflow
  • Install tensorflow.

$ pip install --ignore-installed --upgrade tensorflow==1.9
answered Dec 22, 2020 by MD
• 95,440 points
Hello, thank u for ur help. I don't have anaconda can this be applicable using pip only?


You can do with pip as well. The problem is with the version. You can use the below steps.

  • Uninstall the current version of Tensorflow.

$ pip uninstall tensorflow
  • Reinstall tensorflow 1.15
$ pip install tensorflow==1.15

I tried the following commands it didn't work :

pip uninstall tensorflow 
pip install tensorflow==1.15

I uninstalled python 3.7.7 and installed 3.6 and I tried again it didn't work, it's really weird.

Did you restart your command line after you installed it? Also, check the python version with the command.
no i didnt, how do i restart the command line and yes i checked the python version with the command python --version it's 3.6.0

It happened to me as well. I tried multiple ways to install Tensorflow in my own system. But it shows me a similar type of error. It most probably to the environment-related. You can give it one more try. Just uninstall python and TensorFlow and related packages. And try with another version.

Related Questions In Python

0 votes
1 answer

Error: "Module not found" while importing tensorflow in pycharm.

Try the following: Go to Files -> Settings ...READ MORE

answered Jun 23, 2020 in Python by Sirajul
• 59,230 points
0 votes
1 answer

How to resolve the error while importing cv2 from openCV in python?

I would recommend you go with anaconda ...READ MORE

answered Jul 31, 2019 in Python by Mohammad
• 3,230 points
0 votes
1 answer

Python error "TypeError: 'encoding' is an invalid keyword argument for this function"

Trying using the io module for this ...READ MORE

answered Aug 2, 2019 in Python by Vaishali

edited Oct 7, 2021 by Sarfaraz 14,263 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,207 views
0 votes
1 answer
0 votes
1 answer

I am trying to install PIL module But I end up with an error :

Hi@Nishant, You can use PILLOW instead of PIL. $ ...READ MORE

answered Apr 6, 2020 in Python by MD
• 95,440 points
+1 vote
3 answers

While using pyttsx 3 , I am having the following ERROR, i have installed pypiwin32

Try this: pip uninstall pyttsx3 Then: pip install pyttsx3==2.71 READ MORE

answered Aug 12, 2020 in Python by Eghosa
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP