Ubuntu + new user + ImportError: No module named 'google' - python

I create a new user in Ubuntu16.04. But I can't import tensorflow in the new user. It hint me that, ImportError: No module named 'google'
I use the tensorflow-gpu==1.7.0 + cuda-9.0 + cudnn-7.0 and python 3.5
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
`>>>`import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import * # pylint: disable=redefined-builtin
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ImportError: No module named 'google'

You tried the command:
pip3 install google --user
?

Related

ImportError: cannot import name '_has_torch_function' from 'torch._C'

When I import torch, I get the following error:
I dont know if it has something to do with the fact i just install cuda11.6.
I tried to unintalled and install pytorch , it didn't work.
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/__init__.py", line 603, in <module>
from ._tensor import Tensor
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/_tensor.py", line 15, in <module>
from torch.overrides import (
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/overrides.py", line 33, in <module>
from torch._C import (
ImportError: cannot import name '_has_torch_function' from 'torch._C' (/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/_C.cpython-37m-x86_64-linux-gnu.so)
>>>

zipline ImportError: No module named 'pandas.io.data'

I have installed Microsoft Visual C++ 14.0 and I have uninstalled and installed Anaconda and packages(pandas, pandas-datareader) several times.
Now I installed zipline by pip install zipline but when I try to import zipline I got a importerror
Python 3.5.5 |Anaconda, Inc.| (default, Apr 7 2018, 04:53:16) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import zipline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda3\envs\py35\lib\site-packages\zipline\__init__.py", line 25, in <module>
from . import data
File "C:\Anaconda3\envs\py35\lib\site-packages\zipline\data\__init__.py", line 1, in <module>
from . import loader
File "C:\Anaconda3\envs\py35\lib\site-packages\zipline\data\loader.py", line 26, in <module>
from pandas.io.data import DataReader
ImportError: No module named 'pandas.io.data'

Installing Python package h5py in MinGW/MSYS2 throws ImportError

I installed h5py through the package mingw64-i686-python-h5py in MSYS2. Importing it in a MinGW shell throws the following error:
Python 3.8.2 (default, Apr 9 2020, 14:12:45) [GCC 9.3.0 32 bit] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import h5py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:/msys64/mingw32/lib/python3.8/site-packages/h5py/__init__.py", line 34, in <module>
from . import version
File "C:/msys64/mingw32/lib/python3.8/site-packages/h5py/version.py", line 17, in <module>
from . import h5 as _h5
File "h5py/h5.pyx", line 1, in init h5py.h5
ImportError: DLL load failed while importing defs: The specified procedure could not be found.
Reinstalling the package did not fix it. I installed numpy the same way and it works just fine.

Cannot import python module pyo

I'm trying to import pyo for this project I'm working on but this is the output I get when I try to do so:
Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\spark\AppData\Roaming\Python\Python37\site-packages\pyo\__init__.py", line 28, in <module>
from .lib import analysis as analysis
File "C:\Users\spark\AppData\Roaming\Python\Python37\site-packages\pyo\lib\analysis.py", line 32, in <module>
from ._core import *
File "C:\Users\spark\AppData\Roaming\Python\Python37\site-packages\pyo\lib\_core.py", line 58, in <module>
from .._pyo import *
ImportError: DLL load failed: The specified module could not be found.
I've tried uninstalling and downgrading pyo but I can't seem to get it to import. Can anyone help me out?

Macports Installed Python 2.7 Inccorectly Imports Python 3.5 Numpy

I have a macports installed python however, whenever I try to import numpy after launching python I get the following error message:
Python 2.7.11 (default, Mar 1 2016, 18:40:10)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import numpy
Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/init.py", line 180, in
from . import add_newdocs
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/core/init.py", line 14, in
from . import multiarray
ImportError: cannot import name multiarray
I should also add that I have py27-numpy installed.. however python27 always seems to look for py35-numpy.

Categories