1. Problem description
Recently, my friend encountered this problem when he installed the environment:
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
At the beginning, many people may think that this problem is their CUDA or cudnn
2. Problem analysis
1. My friend’s graphics card is NVIDIA geforce 1060 , the environment is cuda9.0 , cudn7.0 , and then my friend runs the following command:
pip install tensorflow-gpu
2. Report the above mentioned error, check the version, and find that the version is 1.12 version. Here bloggers tell their friends that the version is not compatible with
3. Solutions
1. Uninstall the current tensorflow GPU: 2
pip uninstall tensorflow-gpu
2. Install a lower version of tensorfow GPU, where the blogger installs version 1.7: 2
pip install tensorflow-gpu==1.7
3. After installing this version of tensorflow GPU, there is no error. My friends thank me very much ~ 3
4. What is it_ pywrap_ tensorflow_ internal
1. When we look at the python library, we find that this should be the same as the wrapper file. Check the official websites of tensorflow and Python and some problem-solving websites, we will know: pywrap_ tensorflow_ When the internal.py module is imported, it is loaded_ pywrap_ tensorflow_ Internal.so dynamic link
How did this document come from?When tensorflow uses bazel to compile , swig will generate two wrapper files: pywrap_ tensorflow_ Internal. Py and pywrap_ tensorflow_ Internal. CC , the former is connected with the upper Python call, and the latter is connected with the lower C API call
3. What is swig?A good thing about tensorflow is that it provides such a multilingual front-end interface. Swig encapsulates C/C + + into a python callable so language DLL, so that we can complete the model training and testing of deep learning through other languages
4. a new version of the _pywrap_tensorflow_ If you can’t find the internal module, you can install the older version ~ instead