1

I have been using tensorflow (via Keras) to do some simple image classification tasks. It was working fine late last year (mid-december), but now I have done some package updates and get this error when attempting to run my code:

Traceback (most recent call last):
  File "C:\Python\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Python\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Python\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:\Python\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Python\lib\imp.py", line 342, 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 "image_classify.py", line 3, in <module>
    from keras.preprocessing.image import array_to_img, img_to_array, load_img
  File "C:\Python\lib\site-packages\keras\__init__.py", line 3, in <module>
    from . import utils
  File "C:\Python\lib\site-packages\keras\utils\__init__.py", line 6, in <module>
    from . import conv_utils
  File "C:\Python\lib\site-packages\keras\utils\conv_utils.py", line 9, in <module>
    from .. import backend as K
  File "C:\Python\lib\site-packages\keras\backend\__init__.py", line 1, in <module>
    from .load_backend import epsilon
  File "C:\Python\lib\site-packages\keras\backend\load_backend.py", line 90, in <module>
    from .tensorflow_backend import *
  File "C:\Python\lib\site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
    import tensorflow as tf
  File "C:\Python\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "C:\Python\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Python\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Python\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Python\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Python\lib\site-packages\tensorflow_core\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Python\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Python\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Python\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Python\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:\Python\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Python\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

The natural thing to suspect is that some package update broke something, but I'm not sure which one it might be. I have the (current) most up-to-date versions of both tensorflow (2.1.0) and Keras (2.3.1). I am using a Windows 10 PC with an intel i5-7200U cpu. I am not using tensorflow-gpu because I am running this small task on a laptop without a dedicated gpu, if that helps.

Could anyone help me figure out what changed? Thanks!

mclenard
  • 11
  • 1

1 Answers1

0

Common solution for this issue is you need to install/update Microsoft Visual C++ 2015-2019 Redistributable (x64) from here

For more details please refer similar question answered here.

  • @mclenard, Can you please accept and upvote the answer if it answers your question. Thank You. –  May 08 '20 at 07:15