0

After upgrading to

tensorflow 1.13.1 tensorflow-estimator 1.13.0 tensorflow-gpu 1.13.1

tensorflow stopped working in Python. I got the message at the bottom of this post. I opened the file C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\imp.py and at the line 343 I found these two lines of comment

Issue #24748: Skip the sys.modules check in _load_module_shim;

always load new extension

I checked both here and on github, searching for issue 24748 and I found nothing. I have no idea on what to do to fix the problem.

MESSAGE:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

D:\Users\Angelo\Documents\Python>python
Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\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:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\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 "D:\Users\angelo\Documents\Python\.startup.py", line 3, in <module>
    import tensorflow as tf
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\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:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\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

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
Community
  • 1
  • 1

2 Answers2

0

Probably the version you are upgrading form was compiled against different CUDA, CUDNN versions. Check/reinstall those. TF 1.13.1 should work with CUDA 10.0 and CUDNN 7.5.

If you already have those, check how people dealt with similar problems No Module Named '_pywrap_tensorflow_internal' or Cannot import Tensorflow for GPU on Windows 10

MPękalski
  • 6,873
  • 4
  • 26
  • 36
  • Thanks MPękalski I updated to CUDA 10.1.105_418.96, but the problem remains. I edited The file imp.py in order to print the name of the module that can't be found. It's _pywrap_tensorflow_internal.pyd and it exists and the path is correct. I don't know what else to do. – Angelo Mascaro Mar 11 '19 at 05:27
0

SOLVED After having installed CUDA 10.1 I had also to install CUDNN 7.5 as MPękalski suggested. I did it, but it was not sufficient: I also had to uninstall tensorflow-GPU and tensorflow and re-install them, Only aftern re-installing tensorflow everything worked.

VERY IMPORTANT: in the directory C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin I copied cublas64_10.dll to cublas64_100.dll and cusolver64_10.dll to cusolver64_100.dll (maybe it is sufficient to rename them). If you have the same problem this should be the first thing to do: probably it was necessary to uninstall and reinstall everything.

Secondary suggestion During the CUDA installation I got the message about updating the PATH environment variable and the possible exceeding of the maximum length. I had to manually replace the old path (CUDA 9.0) with the new one.

  • Did everything you suggested, reinstalled tensorflow, tesnsorflow-gpu several times - no effect.. – GreenTea Mar 16 '19 at 17:00
  • GreenTea, probably some other files are missing. To find what was missing I used this tool: https://www.geeks3d.com/forums/index.php?topic=5233.0 It finds the dependencies and shows what are not satisfied. It has a friendly GUI. I found it while searching a solution for this problem. – Angelo Mascaro Mar 18 '19 at 07:18