When I import TensorFlow to Python, I get "Import Error: DLL load failed: The specified module cannot be found."

environment

what happened

Trying to put Google's TensorFlow into Python to study machine learning

pip install tensorflow

And install normally. Installation is completed without any problems. Here, if you check if you can import properly ...

Using TensorFlow backend.
Traceback (most recent call last):
    File "C:...
    ...
    File "C:...
       return _load(spec)
ImportError: DLL load failed:The specified module cannot be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
    File "C:...
    ...
    File "C:...
       return _load(spec)
ImportError: DLL load failed:The specified module cannot be found.


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.

Error appears (it is long, so omitted in the middle). After that, I researched various things and did various things, but I couldn't solve it.

Solution: Downgrade TensorFlow

If you install without specifying the version, the latest version tensorflow == 2.1.0 at the time of article creation will be installed, so specify the old version at the prompt and execute it.

pip install --upgrade tensorflow==2.0.0

Then start the interpreter with the python command

>>> import tensorflow

When I checked with, no error occurred and the import was successful. I'm not sure, but it seems that some TensorFlow instructions cannot be executed with an old CPU.

For the time being, when I specify version 1.10.0 specified on other sites and install it,

pip install --upgrade tensorflow==1.10.0
ERROR: Could not find a version that satisfies the requirement tensorflow==1.10.1 (from versions: 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0)
ERROR: No matching distribution found for tensorflow==1.10.0

I got an error like this and was angry that there was no such version, so I groped for a version without an error from the versions lined up.

Also, when I installed it, I got an error saying "Access is denied", so as I was told

pip install --upgrade tensorflow==2.0.0 --user

And added the --user option. Probably because I installed Anaconda with administrator privileges (I didn't see this option on other sites, so I removed it from the previous description).

Recommended Posts

When I import TensorFlow to Python, I get "Import Error: DLL load failed: The specified module cannot be found."
Error in deep learning "ImportError: DLL load failed: The specified module cannot be found. How to know the "specified module" in.
What to do when "OS Error: [WinError 126] The specified module cannot be found" appears in import torch
Dealing with Tensorflow error "Import Error: DLL load failed: Specified module not found" in deep learning
When I try to import pandas on macOS I get the error No module named'_bz2'
Ll load failed in Anaconda environment construction: The specified module cannot be found. (import numpyas np file ....) Note that the error has been resolved.
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
When I name the file flask.py in Flask, I get Import Error: cannot import name'Flask'
When I try to connect to MySQL with mysql-connector-python, I cannot connect with the error "SSL connection error: SSL_CTX_set_tmp_dh failed"
How to deal with the error "Failed to load module" canberra-gtk-module "that appears when you run OpenCV
I get a Python No module named'encodings' error with the aws command
[Python] I want to know the variables in the function when an error occurs!
Investigation when import cannot be done with python
When I try to install mysqlclient with Django, I get error: command'gcc' failed with exit status 1.
When I deployed the Django app to Heroku, I got Module Not Found: <project-name> .wsgi.
A memo of misunderstanding when trying to load the entire self-made module with Python3
I get an error when I try to raise Python to 3 series using pyenv on Catalina
Python note: When the pip command cannot be used
I get an Import Error in Python Beautiful Soup
What to do when "cannot import name xxx" [Python]
When I try to update the data on DynamoDB with Python (boto3), I get "ExpressionAttributeNames contains invalid key: Syntax error; key: <key name>"
[Small story] How to install the module when pip cannot be used due to proxy etc.
What to do if you get Swagger-codegen in python and Import Error: No module named
Solution when the image cannot be displayed with tkinter [python]
I get [Error 2055] when trying to connect to MySQL on Heroku
Get the source of the page to load infinitely with python.
How to solve when the package cannot be installed due to gpg: keyserver receive failed: General error when doing yay on Manjaro Linux
[Corrective Measures] error: [WinError 2] The specified file cannot be found. ERROR: Command errored out with exit status 1
When I tried to use pip with python, I was told that XML_SetHashSalt could not be found.
A story that didn't work when I tried to log in with the Python requests module
About the error I encountered when trying to use Adafruit_DHT from Python on a Raspberry Pi
I get an error when trying to install maec 4.0.1.0 with pip
I want to run the Python GUI when starting Raspberry Pi
What to do when you get "I can't see the site !!!!"
[Python] When I tried to use matplotlib for graph drawing, I got the error "this application failed to start because it could not find or load the qt platform plugin" windows "".
I get an error when I put a Python plugin in Visual Studio Code under the pyenv environment
How to get the Python version
[Python] How to import the library
I had a hard time with ImportError: DLL load failed in tensorflow 2.0
When I tried to run Python, it was skipped to the Microsoft Store
I tried to get the authentication code of Qiita API with Python.
I get a UnicodeDecodeError when trying to connect to oracle with python sqlalchemy
The file name was bad in Python and I was addicted to import
What to do if you get an error when trying to load mnist
I tried to get the movie information of TMDb API with Python
Address to the bug that node.surface cannot be obtained with python3 + mecab
Switch the module to be loaded for each execution environment in Python
I get an error ~ is zero, singular U when passing the covariance matrix from the Linear layer to MultivariateNormal