简体   繁体   中英

Not able to import tensorflow on anaconda with python 3.6 version on 64bit system with 64bit anaconda

When I import tensorflow it gives me this error:

Traceback (most recent call last): File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 343, in load_dynamic return _load(spec) 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 "", line 1, in import tensorflow as tf File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow__init__.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\\Users\\User\\Anaconda3\\lib\\site-packages\\tensorflow\\python\\pywrap_tensorflow_internal.py", line 24, in swig_import_hel per _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\\Users\\User\\Anaconda3\\lib\\imp.py", line 343, in load_dynamic return _load(spec) 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

Please Help me with this

The following might me the problems :

  • You have not installed Microsoft C++ Redist 2015 Update 3. It contains the missing dll. You need to download the 2015 update 3 version only.

  • Your CPU doesn't support AVX instructions which are needed by TensorFlow. You will need a processer which supports AVX.

I just solved this same issue with my system (Win 10, 64 bit). Following are the details of how I resolved this issue:

  1. Install VS 2017 , tensorflow doesn't use it but having it helps in the smooth installation of CUDA toolkit.
  2. Update NVDIA driver from windows device manager .
  3. Download and Install CUDA toolkit (version 10.1) .
  4. Download and unzip CUDnn 7.6.5 . Copy the extracted files into a folder in C drive.
  5. Add ~\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin , ~\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin and cudnn-10.1-windows10-x64-v7.6.4.38\\cuda\\bin to PATH

Doing import tensorflow as tf after the above steps solved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM