pythontensorflowneural-networkdeep-learningtflearn

How to fix this error while importing tflearn library?


I was importing the tflearn library and I'm getting this error message. I'm new to this and just started to learn through tensorflow. I had problems installing tensorflow through pip as well but it successfully installed after using solution in one of the posts on website

Traceback (most recent call last):
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
  fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\imp.py", line 297, in find_module
  raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
  from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
  _pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
  import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
  import tflearn
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tflearn\__init__.py", line 4, in <module>
  from . import config
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tflearn\config.py", line 3, in <module>
  import tensorflow as tf
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
  from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
  from tensorflow.python import pywrap_tensorflow
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
  raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
  fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\imp.py", line 297, in find_module
  raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
  from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
  _pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Welcome\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
  import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

Solution

  • Main reason for this error is not having vs C++ redistributables dowloaded.

    Make sure all the software requirements mentioned are installed.

    Windows 7 or later (64-bit) Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019