Tag Archives: ModuleNotFoundError

ModuleNotFoundError: No module named ‘torch.utils.serialization’ [How to Solve]

 

1. There is a problem

ModuleNotFoundError: No module named 'torch.utils.serialization'

2. Analyze the reasons

it may be that the version of Python is too new to cause

3. Solutions

1. Install the older version of Python 2

2. Replace with a new version of function: torchfile 2

(1) install torchfile

pip install torchfile

(2)from torch.utils.serialization import load_lua to import torchfile

(3)load_lua to torchfile.load

How to Solve ModuleNotFoundError: No module named ‘pip._internal’

error code:

Traceback (most recent call last): 
  File "/usr/bin/pip", line 7, in <module>
  from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal'

Solution: upgrading Python 2.7.5 of centos7 to Python 3.6,
I compiled and installed it, and when I installed it, I prompted that PIP was successfully installed,
because there was an incompatible version in the resolved dependency
if you upgrade to Python 3.7.2, it will be even more strange. The SSL module won’t work

Solution: there are two ways, one is to install and the other is to upgrade, which are just two commands
installed: 1: WGet https://bootstrap.pypa.io/get-pip.py –No check certificate
2: sudo Python get-pip.Py
upgraded: 1: PIP install — user — upgrade pipenv
2: Python – M PIP install — upgrade pip

ModuleNotFoundError: No module named ‘_pywrap_tensorflow_internal’ [How to Solve]

 

 

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