rainbow12
rainbow12

Reputation: 477

Azure function running with a python version different than the VS code

I'm trying to debug my azure function, with python, in visual studio code. However, when I press F5, I continue to have this problem: connect ECONNREFUSED 127.0.0.1:9091. 

So I noticed that I got this errors on the terminal: 

     1- cannot import name 'cygrpc' from 'grpc._cython'. 

     2- Also, when I press F5, I noticed that my azure function is using python version 3.7.2, but my IDE is using python version 3.9.2

Can someone help me solve this problem please?

Upvotes: 0

Views: 1484

Answers (1)

Richard Belleville
Richard Belleville

Reputation: 1620

cyrgrpc is the module containing the gRPC C extension -- native code that must compile against the API and ABI of a specific Python interpreter version. This seems to come down in a mismatch between the Python version of your package manager (whether it's pip or poetry or something else) and the runtime interpreter being used by your IDE.

Take a look at the installable grpcio wheels here. All except the source distributions (which you probably don't want) include a substring of the filename indicating which version of CPython it was compiled against. For example, grpcio-1.36.1-cp39-cp39-manylinux2010_x86_64.whl is a Python 3.9 wheel.

You haven't supplied the particulars of how the package was installed or the relationship between your IDE's runtime interpreter and your package manager, so I can't help you much there. But you need to ensure that the versions match between the two.

Upvotes: 1

Related Questions