Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks: ImportError: cannot import name 'expr_pb2' from 'google.type' #8034

Closed
blaflamme opened this issue May 18, 2019 · 3 comments
Closed
Assignees
Labels
api: cloudtasks Issues related to the Cloud Tasks API. packaging type: question Request for information or clarification. Not an issue.

Comments

@blaflamme
Copy link

Hi,

two days ago my project using google tasks started to give me this error after doing an upgrade of outdated libs using pipenv lock --pre. I'm trying to figure out what's going on without any success so far.

Environment details

pip freeze output

cachetools==3.1.0
certifi==2019.3.9
chardet==3.0.4
google-api-core==1.11.0
google-auth==1.6.3
google-cloud-bigquery==1.12.0
google-cloud-core==1.0.0
google-cloud-datastore==1.8.0
google-cloud-pubsub==0.41.0
google-cloud-storage==1.16.0
google-cloud-tasks==1.1.0
google-resumable-media==0.3.2
googleapis-common-protos==1.6.0b9
grpc-google-iam-v1==0.11.4
grpcio==1.21.0rc1
idna==2.8
protobuf==3.8.0rc1
pyasn1==0.4.5
pyasn1-modules==0.2.5
pytz==2019.1
requests==2.22.0
rsa==4.0
six==1.12.0
urllib3==1.25.2

Steps to reproduce

  1. Create a venv
  2. Install the above libs
  3. Open up a shell and do from google.cloud import tasks_v2

Stack trace

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/blaflamme/Desktop/cloud-test/lib/python3.7/site-packages/google/cloud/tasks_v2/__init__.py", line 19, in <module>
    from google.cloud.tasks_v2 import types
  File "/Users/blaflamme/Desktop/cloud-test/lib/python3.7/site-packages/google/cloud/tasks_v2/types.py", line 34, in <module>
    from google.type import expr_pb2
ImportError: cannot import name 'expr_pb2' from 'google.type' (/Users/blaflamme/Desktop/cloud-test/lib/python3.7/site-packages/google/type/__init__.py)

Thanks!

@tseaver tseaver added api: cloudtasks Issues related to the Cloud Tasks API. packaging type: question Request for information or clarification. Not an issue. labels May 20, 2019
@tseaver
Copy link
Contributor

tseaver commented May 20, 2019

Thanks for the report. Trying to reproduce in a fresh virtual environment:

$ python3.7 -m venv /tmp/gcp/8034
$ /tmp/gcp/8034/bin/pip install --upgrade setuptools pip wheel
...
Successfully installed pip-19.1.1 setuptools-41.0.1 wheel-0.33.4
$ /tmp/gcp/8034/bin/pip install google-cloud-tasks
...
Successfully installed cachetools-3.1.0 certifi-2019.3.9 chardet-3.0.4 google-api-core-1.11.0 google-auth-1.6.3 google-cloud-tasks-1.1.0 googleapis-common-protos-1.5.10 grpc-google-iam-v1-0.11.4 grpcio-1.20.1 idna-2.8 protobuf-3.7.1 pyasn1-0.4.5 pyasn1-modules-0.2.5 pytz-2019.1 requests-2.22.0 rsa-4.0 six-1.12.0 urllib3-1.25.2
...
$ /tmp/gcp/8034/bin/python -c "from google.cloud import tasks_v2; print(tasks_v2.__path__)"
['/tmp/gcp/8034/lib/python3.7/site-packages/google/cloud/tasks_v2']

Looking at the output from pip freeze:

cachetools==3.1.0
certifi==2019.3.9
chardet==3.0.4
google-api-core==1.11.0
google-auth==1.6.3
google-cloud-tasks==1.1.0
googleapis-common-protos==1.5.10
grpc-google-iam-v1==0.11.4
grpcio==1.20.1
idna==2.8
protobuf==3.7.1
pyasn1==0.4.5
pyasn1-modules==0.2.5
pytz==2019.1
requests==2.22.0
rsa==4.0
six==1.12.0
urllib3==1.25.2

I see you also have google-cloud-datastore, google-cloud-pubsub, and google-cloud-storage installed, so I tried installing them, too:

$ /tmp/gcp/8034/bin/pip install google-cloud-{datastore,pubsub,storage}
...
Successfully installed google-cloud-core-1.0.0 google-cloud-datastore-1.8.0 google-cloud-pubsub-0.41.0 google-cloud-storage-1.16.0 google-resumable-media-0.3.2
$ /tmp/gcp/8034/bin/pip freeze | grep "^g"
google-api-core==1.11.0
google-auth==1.6.3
google-cloud-core==1.0.0
google-cloud-datastore==1.8.0
google-cloud-pubsub==0.41.0
google-cloud-storage==1.16.0
google-cloud-tasks==1.1.0
google-resumable-media==0.3.2
googleapis-common-protos==1.5.10
grpc-google-iam-v1==0.11.4
grpcio==1.20.1
$ /tmp/gcp/8034/bin/python -c "from google.cloud import tasks_v2; print(tasks_v2.__path__)"
['/tmp/gcp/8034/lib/python3.7/site-packages/google/cloud/tasks_v2']

I note also that you have a pre-release version of googleapis-common-protos installed, and so tried bumping it as well:

$ /tmp/gcp/8034/bin/pip install --upgrade googleapis-common-protos==1.6.0b9
...
Successfully installed googleapis-common-protos-1.6.0b9
$ /tmp/gcp/8034/bin/python -c "from google.cloud import tasks_v2; print(tasks_v2.__path__)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/gcp/8034/lib/python3.7/site-packages/google/cloud/tasks_v2/__init__.py", line 19, in <module>
    from google.cloud.tasks_v2 import types
  File "/tmp/gcp/8034/lib/python3.7/site-packages/google/cloud/tasks_v2/types.py", line 34, in <module>
    from google.type import expr_pb2
ImportError: cannot import name 'expr_pb2' from 'google.type' (/tmp/gcp/8034/lib/python3.7/site-packages/google/type/__init__.py)

I don't know if something else you are doing requires the --pre, but please downgrade to `googleapis-common-protos 1.5.10.

I have opened googleapis/gapic-generator-python#122 to track the borked googleapis-common-protos 1.6.0b# release.

@tseaver tseaver closed this as completed May 20, 2019
@tseaver
Copy link
Contributor

tseaver commented May 23, 2019

@blaflamme: @lukesneeringer has just released googleapis-common-protos 1.6.0, which should fix this issue for you.

@blaflamme
Copy link
Author

@tseaver @lukesneeringer thanks for the release!

Just tried to upgrade to 1.6.0 and I now get this error:

python -c "from google.cloud import tasks_v2"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/blaflamme/Desktop/cloud-test/lib/python3.7/site-packages/google/cloud/tasks_v2/__init__.py", line 19, in <module>
    from google.cloud.tasks_v2 import types
  File "/Users/blaflamme/Desktop/cloud-test/lib/python3.7/site-packages/google/cloud/tasks_v2/types.py", line 22, in <module>
    from google.cloud.tasks_v2.proto import cloudtasks_pb2
  File "/Users/blaflamme/Desktop/cloud-test/lib/python3.7/site-packages/google/cloud/tasks_v2/proto/cloudtasks_pb2.py", line 25, in <module>
    from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2
ImportError: cannot import name 'iam_policy_pb2' from 'google.iam.v1' (unknown location)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: cloudtasks Issues related to the Cloud Tasks API. packaging type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants