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

Error when I try to run example code: from grpc._cython import cygrpc as _cygrpc ImportError: cannot import name 'cygrpc' #1540

Closed
antoineChammas opened this issue Jun 25, 2018 · 11 comments

Comments

@antoineChammas
Copy link

In which file did you encounter the issue?

I used the code in the tutorial on my local machine

https://codelabs.developers.google.com/codelabs/cloud-vision-api-python/index.html?index=..%2F..%2Findex#5

Did you change the file? If so, how?

No

Describe the issue

When running the example code locally, I get the error mentioned in the title:
from grpc._cython import cygrpc as _cygrpc ImportError: cannot import name 'cygrpc'

@antoineChammas
Copy link
Author

the problem was with the grcp library not with google cloud, in case anyone stumbles on the same mistake, run python -m pip install grcpio --ignore-installed

@xueluofeng
Copy link

"python -m pip install grcpio --ignore-installed" , is grpcio not grcpio;
But to me is invalid

@zhaodi-Wen
Copy link

you can use "python -m pip install grcpio --ignore-installed"

@xiaoyangnihao
Copy link

xiaoyangnihao commented Jun 25, 2019

is this "python -m pip install grpcio --ignore-installed" useful ? It seems invalid to me, I met the same error, and don't know how to solve it.

@Hamiltonsjtu
Copy link

conda install grpcio works for me

@iugov
Copy link

iugov commented May 16, 2020

Specifying version as grpcio==1.27.2 resolved my issue

@Paprika-a11y
Copy link

is this "python -m pip install grpcio --ignore-installed" useful ? It seems invalid to me, I met the same error, and don't know how to solve it.

Did you find a way to solve this?

@absognety
Copy link

absognety commented Jun 16, 2021

Specifying version as grpcio==1.27.2 resolved my issue

this doesn't work for python 3.9 due to incompatibility issue:

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - grpcio==1.27.2 -> python[version='>=2.7,<2.8.0a0|>=3.8,<3.9.0a0|>=3.6,<3.7.0a0|>=3.7,<3.8.0a0']

Your python: python=3.9

If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.

Is there a way to solve this?

@sadmankiba
Copy link

python3.8 -m pip install -U grpcio worked for me.

@roshanlabh
Copy link

cannot import name 'cygrpc' from 'grpc._cython' (/opt/python/grpc/_cython/__init__.py)

If you are still facing the same issue with AWS Lambda layer and using mac for building the package locally.
Then the solution is to just use linux (ubuntu) to build your google-cloud-* package. It will solve the issue.

@fnsfroskos
Copy link

@roshanlabh Can you provide a link with some detail on how to use linux (ubuntu) to build your google-cloud-* package? Thanks!

cannot import name 'cygrpc' from 'grpc._cython' (/opt/python/grpc/_cython/__init__.py)

If you are still facing the same issue with AWS Lambda layer and using mac for building the package locally. Then the solution is to just use linux (ubuntu) to build your google-cloud-* package. It will solve the issue.

sohamc0 pushed a commit to arkaroy2001/hack-thon that referenced this issue Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests