GeezerVison is showing github.com — google-cloud 0.20.0 'from google.cloud import storage' not working · Issue #2464 · googleapis/google-cloud-python
google-cloud 0.20.0 'from google.cloud import storage' not working #2464DescriptionAfter upgrade:
Collecting google-cloud
Collecting google-cloud-core>=0.20.0 (from google-cloud)
Using cached google_cloud_core-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-language>=0.20.0 (from google-cloud)
Using cached google_cloud_language-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-monitoring>=0.20.0 (from google-cloud)
Using cached google_cloud_monitoring-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-storage>=0.20.0 (from google-cloud)
Using cached google_cloud_storage-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-bigquery>=0.20.0 (from google-cloud)
Using cached google_cloud_bigquery-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-error-reporting>=0.20.0 (from google-cloud)
Using cached google_cloud_error_reporting-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-resource-manager>=0.20.0 (from google-cloud)
Using cached google_cloud_resource_manager-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-vision>=0.20.0 (from google-cloud)
Using cached google_cloud_vision-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-logging>=0.20.0 (from google-cloud)
Using cached google_cloud_logging-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-translate>=0.20.0 (from google-cloud)
Using cached google_cloud_translate-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-datastore>=0.20.0 (from google-cloud)
Using cached google_cloud_datastore-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-dns>=0.20.0 (from google-cloud)
Using cached google_cloud_dns-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-bigtable>=0.20.0 (from google-cloud)
Using cached google_cloud_bigtable-0.20.0-py2.py3-none-any.whl
Collecting google-cloud-pubsub>=0.20.0 (from google-cloud)
Using cached google_cloud_pubsub-0.20.0-py2.py3-none-any.whl
Collecting googleapis-common-protos>=1.3.4 (from google-cloud-core>=0.20.0->google-cloud)
Downloading googleapis-common-protos-1.3.4.tar.gz
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
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: cannot import name 'storage'
Activitychanged the title [-]google-cloud 0.20.0 from google.cloud import storage not working[/-] [+]google-cloud 0.20.0 'from google.cloud import storage' not working[/+] on Sep 29, 2016dhermes commented on Sep 29, 2016 Yay packaging! Try pip show google-cloud-storage.
- What command did you use to install?
- What other
google packages have you installed that may be hopping in front of your import?
VelizarVESSELINOV commented on Sep 29, 2016 I moved today from 0.19.0 to 0.20.0 using pip install -r requirements.txt
after removing the virtual env and recreating again without update, it is working. dhermes commented on Sep 29, 2016 jlowin commented on Oct 4, 2016 I also just upgraded from 0.19 to 0.20 with pip install --upgrade google-cloud and now can't import anything:
In [2]: from google.cloud import datastore
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-46f71c99c111> in <module>()
----> 1 from google.cloud import datastore
ImportError: cannot import name 'datastore'
Uninstall/reinstall had no effect. daspecster commented on Oct 4, 2016 @jlowin, since switching to namespace packages, you'll note in our CONTRIBUTING.rst that importing may not work as expected.
@dhermes, are there any workarounds so our examples work in the CLI REPL? jlowin commented on Oct 4, 2016 @daspecster I used the same import statement in 0.19 without issue (from google.cloud import datastore) daspecster commented on Oct 4, 2016 @jlowin, if you put from google.cloud import datastore in a test_datastore.py file and run it with python test_datastore.py, does that also fail? jlowin commented on Oct 4, 2016 Yes, that also failed -- but I think I've got it -- I had to uninstall both google-cloud and also protobuf, then let google-cloud reinstall protobuf. Reacted by Tautvydas Misiunas dhermes commented on Oct 4, 2016 @jlowin Can you do pip show google-cloud google-cloud-datastore? jlowin commented on Oct 4, 2016 Sure, though after my last comment I think it won't be interesting :)
---
Metadata-Version: 2.0
Name: google-cloud
Version: 0.20.0
Summary: API Client library for Google Cloud
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google Cloud Platform
Author-email: [email protected]
Installer: pip
License: Apache 2.0
Location: /Users/jlowin/anaconda3/lib/python3.5/site-packages
Requires: google-cloud-language, google-cloud-bigquery, google-cloud-bigtable, google-cloud-datastore, google-cloud-dns, google-cloud-resource-manager, google-cloud-logging, google-cloud-translate, google-cloud-vision, google-cloud-pubsub, google-cloud-storage, google-cloud-monitoring, google-cloud-core, google-cloud-error-reporting
Classifiers:
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Topic :: Internet
---
Metadata-Version: 2.0
Name: google-cloud-datastore
Version: 0.20.0
Summary: Python Client for Google Cloud Datastore
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google Cloud Platform
Author-email: [email protected]
Installer: pip
License: Apache 2.0
Location: /Users/jlowin/anaconda3/lib/python3.5/site-packages
Requires: google-cloud-core, grpcio
Classifiers:
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Topic :: Internet
jlowin commented on Oct 4, 2016 Ok, I can create this error deterministically (on my machine at least):
pip uninstall google-cloud
pip install "google-cloud==0.19"
pip install google-cloud --upgrade
python -c "from google.cloud import datastore"
result:
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name 'datastore'
dhermes commented on Oct 4, 2016 Indeed.
$ virtualenv venv
$ source venv/bin/activate
(venv) $ venv/bin/pip install "google-cloud==0.19"
Collecting google-cloud==0.19
...
(venv) $ venv/bin/python -c "from google.cloud import datastore"
(venv) $ echo ${?}
0
(venv) $ venv/bin/pip install --upgrade google-cloud
Collecting google-cloud
...
(venv) $ venv/bin/python -c "from google.cloud import datastore"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name datastore
(venv) $ venv/bin/pip freeze
enum34==1.1.6
future==0.15.2
futures==3.0.5
gapic-google-logging-v2==0.10.1
gapic-google-pubsub-v1==0.10.1
google-cloud==0.20.0
google-cloud-bigquery==0.20.0
google-cloud-bigtable==0.20.0
google-cloud-core==0.20.0
google-cloud-datastore==0.20.0
google-cloud-dns==0.20.0
google-cloud-error-reporting==0.20.0
google-cloud-language==0.20.0
google-cloud-logging==0.20.0
google-cloud-monitoring==0.20.0
google-cloud-pubsub==0.20.0
google-cloud-resource-manager==0.20.0
google-cloud-storage==0.20.0
google-cloud-translate==0.20.0
google-cloud-vision==0.20.0
google-gax==0.14.1
googleapis-common-protos==1.3.5
grpc-google-iam-v1==0.10.1
grpc-google-logging-v2==0.10.1
grpc-google-pubsub-v1==0.10.1
grpcio==1.0.0
httplib2==0.9.2
oauth2client==3.0.0
ply==3.8
protobuf==3.1.0.post1
pyasn1==0.1.9
pyasn1-modules==0.0.8
rsa==3.4.2
six==1.10.0
whereas installed just fresh
$ virtualenv venv
$ source venv/bin/activate
(venv) $ venv/bin/pip install --upgrade google-cloud
Collecting google-cloud
...
(venv) $ venv/bin/python -c "from google.cloud import datastore"
(venv) $ echo ${?}
0
(venv) $ venv/bin/pip freeze
enum34==1.1.6
future==0.15.2
futures==3.0.5
gapic-google-logging-v2==0.10.1
gapic-google-pubsub-v1==0.10.1
google-cloud==0.20.0
google-cloud-bigquery==0.20.0
google-cloud-bigtable==0.20.0
google-cloud-core==0.20.0
google-cloud-datastore==0.20.0
google-cloud-dns==0.20.0
google-cloud-error-reporting==0.20.0
google-cloud-language==0.20.0
google-cloud-logging==0.20.0
google-cloud-monitoring==0.20.0
google-cloud-pubsub==0.20.0
google-cloud-resource-manager==0.20.0
google-cloud-storage==0.20.0
google-cloud-translate==0.20.0
google-cloud-vision==0.20.0
google-gax==0.14.1
googleapis-common-protos==1.3.5
grpc-google-iam-v1==0.10.1
grpc-google-logging-v2==0.10.1
grpc-google-pubsub-v1==0.10.1
grpcio==1.0.0
httplib2==0.9.2
oauth2client==3.0.0
ply==3.8
protobuf==3.1.0.post1
pyasn1==0.1.9
pyasn1-modules==0.0.8
rsa==3.4.2
six==1.10.0
dhermes commented on Oct 4, 2016 What's very strange is that pip freeze is identical.
Not sure what we can do though. It's likely a bug with pip or setuptools. All we can do is recommend a clean uninstall / fresh environment. Reacted by Roman Hartmann and Praveen Kumar jlowin commented on Oct 4, 2016 bizarre and you're right, maybe nothing you can do! I'd at least recommend adding that note about the 0.19 -> 0.20 upgrade path to README though, I bet a lot of people will get bitten just through normal requirements.txt dependency installation! For what it's worth I continued the conversation at #2493 (comment) with the steps that resolved this for me. listentojohan commented on Feb 7, 2018 I just encountered the same problem, but have had it working before.
Version: 1.2.0
Summary: Python Client for Google Cloud Storage
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google Cloud Platform
Author-email: [email protected]
License: Apache 2.0
Location: /usr/local/lib/python3.6/site-packages
Requires: google-resumable-media, google-auth, requests, google-cloud-core```
listentojohan commented on Feb 7, 2018 Uninstalling and doing a clean install did solve it. Reacted by Thomas Schultz listentojohan commented on Apr 3, 2018 I am however now experiencing the same with a python:2 docker image using google.cloud storage.
Getting:
ImportError: Google Cloud Storage I/O not supported for this execution environment (could not import storage API client). VelizarVESSELINOV commented on Apr 20, 2018 Again after updating google-storage-cloud the package didn't work due to residual google packages with mismatch dependency.
Needed to delete all the old packages that pip3 uninstall google-cloud was ignoring using:
pip3 list | grep google | awk '{print $1}' | xargs pip uninstall -y
Hopefully one day Google will master pip or improve pip system. Ieshu commented on Jul 17, 2020 from google.cloud import bigtable
gives this error-->
ImportError: cannot import name 'init_grpc_aio' from 'grpc._cython.cygrpc' (C:\Users\PYTHON\lib\site-packages\grpc_cython\cygrpc.cp37-win_amd64.pyd) Lavedonio commented on Oct 1, 2020 Had this weird problem where the from google.cloud import storage line would work in the Python interpreter but would spit out this error while running within a file.
Running pip install --upgrade google-cloud-storage was enough for it to be solved in my case. I guess it's indeed a bug in pip. Reacted by Arjit Katare, jyotsnakanikella and kangear
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|