I'm following the guide here:
https://cloud.google.com/storage/docs/reference/libraries#
And installed the module like this:
sudo pip3 install google-cloud-storage
It was successful, but then:
$ python3
Python 3.4.2 (default, Jan 10 2015, 20:44:27)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import storage
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'google'
>>>
Everything else I do with the 'googleapiclient' module works fine. I'm just trying to create a storage bucket.
@jorvis This is a fairly common issue. It means either
google namespace which isn't playing nice with others.Check out #2366 and LMK if that helps?
I am going to pre-emptively close out since this isn't new / isn't an issue with google-cloud-python. However, I'm happy to keep helping as you troubleshoot your install.
UPDATE: This list may help
Thanks for the help. I went to my /usr/local/lib/python3.4/dist-packages directory and deleted protobuf and google*. Then successfully ran "sudo pip3 install google-cloud" I see that it created many directories, including 'google', but I still get the same error when I import.
You should do two things. First check where the google package actually comes from:
$ python3 -c 'import google; print(google.__file__)'
Second try to install in a virtualenv and see if the issue persists:
$ virtualenv venv
$ source venv/bin/activate
(venv) $ venv/bin/pip install google-cloud-storage
(venv) $ venv/bin/python -c 'import google.cloud.storage'
(venv) $ # cheer that it succeeded
(venv) $ # clean-up
(venv) $ deactivate
$ rm -fr venv/
OK, I got it. The python3 which appears first in my PATH is /opt/Python-3.4.2/bin/python3 but for some reason the libraries got installed in /usr/local/lib/python3.4/dist-packages. When I used the correct pip3 path they got placed in /opt/Python-3.4.2/lib/python3.4/site-packages instead and all was well.
Thanks again!
Good to hear
Most helpful comment
You should do two things. First check where the
googlepackage actually comes from:Second try to install in a
virtualenvand see if the issue persists: