Getting "ImportError: failed to load core gRPC library" while running python "greeter_server.py"

1,061 views
Skip to first unread message

bhar...@gmail.com

unread,
Apr 1, 2016, 7:56:17 AM4/1/16
to grpc.io

Hi All,

I am getting "ImportError: failed to load core gRPC library" while running python hello program "greeter_server.py" and "greeter_client.py".

I checked that python module successfully installed with grpc-release-0_13_0 (checked using import grpc.beta). Please let me know if I need to setup some env variable, path or some package / software missing.

=====================
Getting below error
=====================

C:\bharat\gRPC\grpc-release-0_13_0>python greeter_server.py
Traceback (most recent call last):
  File "greeter_server.py", line 34, in <module>
    import helloworld_pb2
  File "C:\bharat\gRPC\grpc-release-0_13_0\helloworld_pb2.py", line 109, in <module>
    from grpc.beta import implementations as beta_implementations
  File "C:\Python27\lib\site-packages\grpc\beta\implementations.py", line 38, in <module>
    from grpc._adapter import _intermediary_low
  File "C:\Python27\lib\site-packages\grpc\_adapter\_intermediary_low.py", line 57, in <module>
    from grpc._adapter import _low
  File "C:\Python27\lib\site-packages\grpc\_adapter\_low.py", line 34, in <module>
    from grpc._cython import cygrpc
  File "src\python\grpcio\grpc\_cython\cygrpc.pyx", line 66, in init grpc._cython.cygrpc (./src/python/grpcio\grpc/_cython/cygrpc.c:27773)
    _module_state = _ModuleState()
  File "src\python\grpcio\grpc\_cython\cygrpc.pyx", line 58, in grpc._cython.cyg rpc._ModuleState.__cinit__ (./src/python/grpcio\grpc/_cython/cygrpc.c:21226)
    raise ImportError('failed to load core gRPC library')
ImportError: failed to load core gRPC library

C:\bharat\gRPC\grpc-release-0_13_0>

====================================
Steps for GRPC installation on Windows 7
====================================

install VC++ COmpiler for Python 2.7 (aka.ms/vcpython27)

 

cd grpc

pip install -rrequirements.txt

set GRPC_PYTHON_BUILD_WITH_CYTHON=1

pip install .


Thanks & Regards

Bhartendu M.

Masood Malekghassemi

unread,
Apr 1, 2016, 5:40:24 PM4/1/16
to grpc.io, bhar...@gmail.com
Ack, you tried to install Python from source on Windows, didn't you? We don't support that due to vcpython27 choking on the gRPC core C files (Microsoft hasn't updated vcpython27 beyond MSVS 2008 so it doesn't handle the 1999 C standard *shakes fist*).

You'll want to install from PyPI for now: `pip install grpcio`. The Windows wheels we've uploaded there come with the missing core component. Please touch base if that doesn't work for you!

Further, for our reference, which instructions did you follow? We should caveat whatever you read with a note about Windows for the time being...

raul.p...@gmail.com

unread,
Jun 3, 2016, 5:32:41 AM6/3/16
to grpc.io, bhar...@gmail.com
Hey Massood! Had the same issue, solved it using your suggestion. The link was found in the python gRPC sample  (https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/speech/api): 

If you're running the speech_streaming.py sample:

$ pip install -r requirements-speech_grpc.txt

+ export ... part is not working on windows. The export equivalent is SET.

Hope this helps!
Reply all
Reply to author
Forward
0 new messages