Python Forum

Full Version: trying to locate a working grpc to install
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to find a working grpc to install.
The command I tried and result was
>py -m pip install grpc
Collecting grpc
Using cached https://files.pythonhosted.org/packages/...-19.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\major\AppData\Local\Temp\pip-install-mybqpm3g\grpc\setup.py", line 7, in <module>
version_tuple = __import__('grpc').VERSION
File "C:\Users\major\AppData\Local\Temp\pip-install-mybqpm3g\grpc\grpc\__init__.py", line 6, in <module>
from .rpc import *
File "C:\Users\major\AppData\Local\Temp\pip-install-mybqpm3g\grpc\grpc\rpc.py", line 141
except OSError, ex:
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in C:\Users\major\AppData\Local\Temp\pip-install-mybqpm3g\grpc\

SO any1 give me a hint as to where I can get a good version?
python version?
pip install grpc will try to install this package - https://pypi.org/project/grpc/
As you can see it's not updated since 2016, i.e. looks not maintained any longer

better check this one
https://pypi.org/project/grpcio/
for it there are also windows binaries on Gohlke

or this one
https://pypi.org/project/grpcalchemy/
https://pypi.org/project/grpcalchemy/
Ok thanks for that.
I have installed grpcio and re-ran what I was trying and got a module not found error from an import grpc.
I changed the py file to use grpcio instead and got the same error.
I did pip show grpcio and got
Name: grpcio
Version: 1.18.0
Summary: HTTP/2-based RPC framework
Home-page: https://grpc.io
Author: The gRPC Authors
Author-email: [email protected]
License: Apache License 2.0
Location: c:\users\major\appdata\roaming\python\python37\site-packages
Requires: six
Required-by: aiogrpc

I checked the site-packages folder and could not find a sub folder called grpcio.
There is one called grpcio-1.18.0.dist-info
At the moment I am confused again.

p.s. any1 tell me why my profile has 'Programmer Named Tim' under my logo?
(May-09-2019, 05:26 PM)MrMajorThorburn Wrote: [ -> ]p.s. any1 tell me why my profile has 'Programmer Named Tim' under my logo?
https://python-forum.io/misc.php?action=help&hid=29
as to your question - I can only refer you to the docs of the package https://grpc.io/docs/
Quick test,homepage
Doing it in virtual environment,it's now build into Python newer versions as you use 3.7.
E:\div_code
λ python -m venv grpv_env

E:\div_code
λ cd grpv_env\

E:\div_code\grpv_env
λ E:\div_code\grpv_env\Scripts\activate

# Install into environment
(grpv_env) E:\div_code\grpv_env
λ pip install grpcio
Collecting grpcio
  Downloading .....
Installing collected packages: six, grpcio
Successfully installed grpcio-1.20.1 six-1.12.0

(grpv_env) E:\div_code\grpv_env
λ pip install ptpython
Collecting ptpython ....
  Installing collected packages: parso, jedi, docopt, pygments, wcwidth, prompt-toolkit, ptpython
Successfully installed docopt-0.6.2 jedi-0.13.3 parso-0.4.0 prompt-toolkit-2.0.9 ptpython-2.0.4 pygments-2.4.0 wcwidth-0.1.7
I also install ptpython into environment,this make a lot easier to explore a package that not has so much Python documentation.
(grpv_env) E:\div_code\grpv_env
λ ptpython
>>> import grpc

>>> grpc.__version__
'1.20.1'
So there is a lot of method under grpc eg grpc.Call ect...
As i using ptpython all methods is showing up automatically after grpc.,with doc string.
There is a lot method if list all without special methods(__something__).
Output:
>>> [i for i in dir(grpc) if not i.startswith('__')] ['AuthMetadataContext', 'AuthMetadataPlugin', 'AuthMetadataPluginCallback', 'Call', 'CallCredentials', 'Channel', 'ChannelConnectivity', 'ChannelCredentials', 'ClientCallDetails', 'Future', 'FutureCancelledError', 'FutureTimeoutError', 'GenericRpcHandler', 'HandlerCallDetails', 'RpcContext', 'RpcError', 'RpcMethodHandler', 'Server', 'ServerCertificateConfiguration', 'ServerCredentials', 'ServerInterceptor', 'ServiceRpcHandler', 'ServicerContext', 'Status', 'StatusCode', 'StreamStreamClientInterceptor', 'StreamStreamMultiCallable', 'StreamUnaryClientInterceptor', 'StreamUnaryMultiCallable', 'UnaryStreamClientInterceptor', 'UnaryStreamMultiCallable', 'UnaryUnaryClientInterceptor', 'UnaryUnaryMultiCallable', '_create_servicer_context', '_cygrpc', '_cython', '_grpcio_metadata', 'abc', 'access_token_call_credentials', 'channel_ready_future', 'composite_call_credentials', 'composite_channel_credentials', 'contextlib', 'dynamic_ssl_server_credentials', 'enum', 'insecure_channel', 'intercept_channel', 'logging', 'metadata_call_credentials', 'method_handlers_generic_handler', 'secure_channel', 'server', 'six', 'ssl_channel_credentials', 'ssl_server_certificate_configuration', 'ssl_server_credentials', 'stream_stream_rpc_method_handler', 'stream_unary_rpc_method_handler', 'sys', 'unary_stream_rpc_method_handler', 'unary_unary_rpc_method_handler']
Version pip show:
(grpv_env) E:\div_code\grpv_env
λ pip show grpcio
Name: grpcio
Version: 1.20.1
Summary: HTTP/2-based RPC framework
Home-page: https://grpc.io
Author: The gRPC Authors
Author-email: [email protected]
License: Apache License 2.0
Location: e:\div_code\grpv_env\lib\site-packages
Requires: six
Required-by:
Looking at doc there is also pip install grpcio-tools
With a hello world example after clone from Repo.
So can do a test of that:
(grpv_env) E:\div_code\grpv_env
λ pip install grpcio-tools
Collecting grpcio-tools
  Downloading .....      
Installing collected packages: protobuf, grpcio-tools
Successfully installed grpcio-tools-1.20.1 protobuf-3.7.1

(grpv_env) E:\div_code\grpv_env
λ git clone -b v1.20.0 https://github.com/grpc/grpc
Cloning into 'grpc'...
Checking out files: 100% (10008/10008), done.
Test server --> client.
(grpv_env) E:\div_code\grpv_env\grpc\examples\python\helloworld ((no branch))
λ python greeter_server.py
Now in a other cmder window.
(grpv_env) E:\div_code\grpv_env\grpc\examples\python\helloworld ((no branch))
λ python greeter_client.py
Greeter client received: Hello, you!
Ok so the greeter test worked.
So if this means I have a working grpc in my gitrep can I somehow install it from there?

It seems to me that trying to resolve my problem with grpc when the product has moved on and its function is now under grpcio that trying to fix my problem with grpc is a waste of everyone's time.

I have other errors I want to ask about so will raise an new item for the next one and leave this to die.