Search code examples
pythontensorflowmachine-learningchatbottflearn

Getting Error Message while using tensorflow


I have installed tensorflow with the pip command. But whenever I try to use it in my code by importing it gives me error. I can't figure out why I am getting this error. Also am unable to use tflearn. Also I just have started coding in python recently. Here's the error message :

Proper view : https://justpaste.it/56znr

Traceback (most recent call last):
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
from tensorflow_core import *
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Aaman\anaconda3\envs\chatbot\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

Here's how I checked if it was installed properly :

C:\Users\Aaman>pip show tensorflow     
Name: tensorflow     
Version: 2.1.0       
Summary: TensorFlow is an open source machine learning framework for everyone.   
Home-page: https://www.tensorflow.org/     
Author: Google Inc.      
Author-email: [email protected]        
License: Apache 2.0        
Location: c:\users\aaman\anaconda3\envs\chatbot\lib\site-packages      
Requires: protobuf, scipy, keras-applications, keras-preprocessing, absl-py, tensorboard, wrapt, opt-einsum, google-pasta, astor, numpy, tensorflow-estimator, six, wheel, grpcio, gast, termcolor
Required-by:

Solution

  • You need to download and install/update the Microsoft Visual C++ 2015-2019 Redistributable (x64) from here.

    If you are facing any other issues possible reasons are

    • Your CPU does not support AVX2 instructions
    • Your CPU/Python is on 32 bits
    • There is a library that is in a different location/not installed on your system that cannot be loaded.

    Please refer tested build configurations for windows CPU and GPU.