Reputation: 326
I installed TensorFlow with CPU support with CUDA Toolkit v9.0 and cuDNNv7.1 and Python 3.6 in Conda enviroment.
I followed the instructions described in TensorFlow website, and when I tried:
import tensorflow as tf
I got this error:
Traceback (most recent call last):
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
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 "<stdin>", line 1, in <module>
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\31121\AppData\Local\conda\conda\envs\tensorflow_gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.
Did I miss something?
Upvotes: 6
Views: 41999
Reputation: 1
You're probably using incompatible versions of python and tensorflow. One way is to install miniconda and create a virtual environment with python 3.11 Install tensorflow version 2.12 This worked for me....
Upvotes: 0
Reputation: 51
I had the same problem. I realized my cpu didn't support AVX. I downgraded tensorflow to 1.5 and it worked like a charm
pip install tensorflow==1.5
if not you can also try installing tensorflow from source here in case your cpu doesn't support AVX either.
Upvotes: 0
Reputation: 5760
I had a similar issue. I have a computer with an Intel Celeron J3455 and I discovered thath my CPU doesn't support AVX, so I can't use official binaries from TensorFlow 1.6 included.
As ABHAY KOTAL proposes, you can use a unofficial wheel that you can find in the following repository: https://github.com/fo40225/tensorflow-windows-wheel
In my case, I choosed Tensorflow 1.15 for Python 3.7 (py37
): tensorflow-1.15.0-cp37-cp37m-win_amd64.whl
. If you want another version, download an avaliable sse2
version.
To install the new TensorFlow:
pip install tensorflow-1.15.0-cp37-cp37m-win_amd64.whl
Remember to uninstall before the previous TensorFlow version installed:
pip uninstall tensorflow tensorboard tensorboard-plugin-wit tensorflow-estimator tensorflow-tensorboard
Upvotes: 1
Reputation: 37
Here is a simple solution (no conda, no gpu/cpu staff)
Uninstall any version of tensorflow you have already installed.
pip uninstall tensorflow
install tensorflow 1.15
pip install tensorflow==1.15
run python
then try import tensorflow
Upvotes: 3
Reputation: 694
you get the problem when used pip not conda
the best answer is (it's work 100%):
type following command: if already install TensorFlow you should reinstall it by the following command:
pip uninstall TensorFlow
if not, install it by the following command :
conda install TensorFlow
I get this solution from this link below :
https://github.com/tensorflow/tensorflow/issues/23683#issuecomment-513788003
thank's @sdmars Tamiris Crepalde she is helping me to get the solution:
Upvotes: 3
Reputation: 1
found this solution on another thread: https://github.com/tensorflow/tensorflow/issues/23683
People, I have solved my problem taking another path. I uninstalled the TensorFlow package that I installed using pip and reinstall using "conda install TensorFlow" and it worked! Now I can import TensorFlow without problems. Hope this can help you guys too!
Upvotes: 0
Reputation: 163
I have found solution for this it might be that your cpu doesnt support AVX so I install tensorflow from this custommade repository found on github link is here
https://github.com/fo40225/tensorflow-windows-wheel
I selected 1.12.0 for py 37 in that folder select py36 folder and cpu folder and download the file within sse2
cpu which doesn support download sse2 whl
Upvotes: 6
Reputation: 21
I had a similar problem. I knew that my CPU (Pentium G4560) does not support AVX, so I changed tensorflow version from 1.6 to 1.5. There is a link for the manual:
https://github.com/rohit-patel/Install_Instructions-Win10-Deeplearning-Keras-Tensorflow
Upvotes: 2