Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
678 views
in Technique[技术] by (71.8m points)

python - Tensorflow 1.9 for CPU, without GPU still requires cudNN - Windows

I am working on a Win10 machine, with python 3.6.3 and using tensorflow 1.9, pip 18.0. I did not provide an option to install tensorflow with gpu, (i.e.), according to this link1, I used

    pip install tensorflow

and did not provide option for using GPU. However, when trying to import tensorflow, I am faced with the following error

    ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

After following various links, link2,link3, I installed the Visual studio update 3 and also used the script provided tensorflow self check, and came across this following error:

    Could not load 'cudart64_80.dll'. .....
    Could not load 'nvcuda.dll' .......
    Could not load 'cudnn64_5.dll' ........

Why is my Tensorflow looking for these packages, when I installed it without GPU? MY system doesn't house a GPU at the moment. I tried uninstall and reinstalling with the upgraded pip 18.0, but the issue persists. How can this be rectified.?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The self-check script from that link is labeled as "DEPRECATED" so it may not work for the latest version (at least not for TensorFlow 1.9 with GPU since that would require cudart64_90.dll instead of cudart64_80.dll). Also, the script simply checks all possible missing files which could be needed by either the CPU or the GPU version. The detailed message tells you which files are only needed by the GPU version.

You may first double-check the GPU version is not installed, if you are not sure about it, by executing pip show tensorflow-gpu. There should be nothing showing up if you have only installed the CPU version.

I encountered a problem yesterday while upgrading the GPU version from 1.8 to 1.9. The problem might not be exactly the same as yours but could be related since my problem was also caused by a failed _pywrap_tensorflow_internal import due to a DLL loading failure. If your problem is also caused by a DLL loading failure, which is explicitly mentioned in the stack trace message, you could consider using this approach to pinpoint the problem:

  1. Use the DLL dependency analyzer Dependencies to analyze <Your Python Dir>Libsite-packagesensorflowpython\_pywrap_tensorflow_internal.pyd and determine the exact missing DLL (indicated by a ? beside the DLL).

  2. Look for information of the missing DLL and install the appropriate package to resolve the problem.

In my case the missing library is VCOMP140.dll, which is Microsoft's OpenMP library and was not needed by the 1.8 version. I installed VC++ Redistributable for VS 2017 and the problem is resolved.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...