Hi Ankit,

I span up a Ubuntu 16.04 machine to investigate this issue. I used the 
default Python2.7, and installed `pip` through `get-pip.py`. And I 
Installed `grpcio` through `pip`.

Here are the version infos of my machine:
$ uname -a
Linux lidiz-dev-ubuntu-16-04 4.15.0-1023-gcp #24~16.04.1-Ubuntu SMP Wed Oct 
10 20:39:59 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$ pip show grpcio
Name: grpcio
Version: 1.16.0
Summary: HTTP/2-based RPC framework
Home-page: https://grpc.io
Author: The gRPC Authors
Author-email: grpc-io@googlegroups.com
License: Apache License 2.0
Location: /home/lidiz/.local/lib/python2.7/site-packages
Requires: six, enum34, futures
Required-by: grpcio-tools

The command I run to get example to work:
# Installation
$ curl https://bootstrap.pypa.io/get-pip.py | sudo python
$ python -m pip install grpcio grpcio-tools googleapis-common-protos --user 
# Install gRPC and dependencies for the example

# First Terminal
lidiz@lidiz-dev-ubuntu-16-04:~/src/grpc/examples/python/helloworld$ python 
greeter_server.py

# Second Terminal
lidiz@lidiz-dev-ubuntu-16-04:~/src/grpc/examples/python/helloworld$ python 
greeter_client.py
Greeter client received: Hello, you!

It works on my machine, I guess there is a difference in the settings. I 
will continue to investigate this.

Lidi Zheng

On Friday, November 9, 2018 at 10:00:33 AM UTC-8, ankitpa...@gmail.com 
wrote:
>
> Hi Lidi 
>
> $ python -m SimpleHTTPServer 8000
> $ curl http://localhost:8000  *Works.*
>
>
> $ nc -6 -l 1234                                  # in one terminal
> $ echo 'Hello' | nc localhost 1234     # in another terminal
> # The 'Hello' should appear in the first terminal  *Works.*
>
>
> # Check your gRPC Python version
> $ pip show grpcio
>
> ---
> Metadata-Version: 2.1
> Name: grpcio
> Version: 1.16.0
> Summary: HTTP/2-based RPC framework
> Home-page: https://grpc.io
> Author: The gRPC Authors
> Author-email: grp...@googlegroups.com <javascript:>
> Installer: pip
> License: Apache License 2.0
> Location: /usr/local/lib/python2.7/dist-packages
> Requires: six, enum34, futures
> Classifiers:
>   Development Status :: 5 - Production/Stable
>   Programming Language :: Python
>   Programming Language :: Python :: 2
>   Programming Language :: Python :: 2.7
>   Programming Language :: Python :: 3
>   Programming Language :: Python :: 3.4
>   Programming Language :: Python :: 3.5
>   Programming Language :: Python :: 3.6
>   License :: OSI Approved :: Apache Software License
>
> i am still not able to make it work :(
>
> thanks
> Ankit
>
>
> On Thursday, November 8, 2018 at 2:50:56 PM UTC-8, li...@google.com wrote:
>>
>> Hi Ankit,
>>
>> Sorry to hear that none of the fixes work for you. If the server is 
>> started and able to bind tcp port, there is a great chance that this might 
>> due to some local network setting.
>>
>> To detect whether there is a local network issue or gRPC Python issue, 
>> can you try to start other applications that bind a port and try to 
>> communicate with it?
>>
>> For example, you can try:
>>
>> $ python -m SimpleHTTPServer 8000
>> $ curl http://localhost:8000
>> # Or visit this address in browser, it should show up a valid HTML web 
>> page
>>
>> or
>>
>> $ nc -6 -l 1234                                  # in one terminal
>> $ echo 'Hello' | nc localhost 1234     # in another terminal
>> # The 'Hello' should appear in the first terminal
>>
>> If one of those work, then there might be some issue with gRPC Python. If 
>> so, can you provide your gRPC Python version as well?
>> # Check your gRPC Python version
>> $ pip show grpcio
>>
>> Bests,
>> Lidi
>>
>>
>> On Thursday, November 8, 2018 at 9:18:32 AM UTC-8, ankitpa...@gmail.com 
>> wrote:
>>>
>>> Hi Lidi 
>>>
>>> greeterserver.py is running on a terminal from other terminal i can see 
>>> that port 50051 is bound to python
>>> # lsof -i :50051
>>> COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
>>> python  18126 root    6u  IPv6  32226      0t0  TCP *:50051 (LISTEN)
>>> root@fmx215:~/gRPC/grpc/examples/python/helloworld# 
>>>
>>> I am behind corporate proxy; but i think they are working fine since I 
>>> am able to reach ernal internet as well as reach to nodes on internal 
>>> network
>>> i am not sure if corporate proxy would alter or redirect any traffic 
>>> here.
>>>
>>>
>>> following is my /etc/hosts file 
>>> 127.0.0.1       localhost
>>> 127.0.1.1       fmx215.xx.xxx.com     fmx215
>>>
>>> # The following lines are desirable for IPv6 capable hosts
>>> ::1     localhost ip6-localhost ip6-loopback
>>> ff02::1 ip6-allnodes
>>> ff02::2 ip6-allrouters
>>>
>>> I am still unable to get this example working. please let me know what 
>>> else i can check or do to make it working
>>>
>>> thanks
>>> Ankit 
>>> On Wednesday, November 7, 2018 at 4:40:59 PM UTC-8, li...@google.com 
>>> wrote:
>>>>
>>>> Hi Ankit,
>>>>
>>>> After the greeter_server.py started, have you observed the port 50051 
>>>> been bound in your system? Also, have you use any sort of VPN or local 
>>>> proxy that may redirect the traffic? One more check, is there a loopback 
>>>> entry for 'localhost' in your /etc/hosts?
>>>>
>>>> Lidi
>>>>
>>>> On Wednesday, November 7, 2018 at 4:26:48 PM UTC-8, 
>>>> ankitpa...@gmail.com wrote:
>>>>>
>>>>> I have ubuntu server system 
>>>>>
>>>>> #lsb_release -a
>>>>> Distributor ID: Ubuntu
>>>>> Description:    Ubuntu 16.04.5 LTS
>>>>> Release:        16.04
>>>>> Codename:       xenial
>>>>>
>>>>> #uname -a
>>>>> Linux fmx215 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 
>>>>> 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
>>>>>
>>>>> I am trying to run  python quick start example  step by step as 
>>>>> explained  on https://grpc.io/docs/quickstart/python.html  
>>>>> <https://grpc.io/docs/quickstart/python.html>
>>>>>
>>>>> greeter_server.py runs without any error and wait for 
>>>>> greeter_client.py 
>>>>>
>>>>> while running greeter_client.py it fails.
>>>>>
>>>>> # python greeter_client.py 
>>>>> Traceback (most recent call last):
>>>>>   File "greeter_client.py", line 35, in <module>
>>>>>     run()
>>>>>   File "greeter_client.py", line 30, in run
>>>>>     response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
>>>>>   File "/usr/local/lib/python2.7/dist-packages/grpc/_channel.py", line 
>>>>> 533, in __call__
>>>>>     return _end_unary_response_blocking(state, call, False, None)
>>>>>   File "/usr/local/lib/python2.7/dist-packages/grpc/_channel.py", line 
>>>>> 467, in _end_unary_response_blocking
>>>>>     raise _Rendezvous(state, None, None, deadline)
>>>>> grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
>>>>>         status = StatusCode.UNAVAILABLE
>>>>>         details = "Socket closed"
>>>>>         debug_error_string = 
>>>>> "{"created":"@1541634693.250829735","description":"Error received from 
>>>>> peer","file":"src/core/lib/surface/call.cc","file_line":1017,"grpc_message":"Socket
>>>>>  
>>>>> closed","grpc_status":14}"
>>>>>
>>>>>
>>>>> https://stackoverflow.com/questions/53129263/run-grpc-python-example-must-use-sudo-command
>>>>>   
>>>>> <https://stackoverflow.com/questions/53129263/run-grpc-python-example-must-use-sudo-command>seem
>>>>>  
>>>>> to be same issue but adding "sudo" doesn't help me. I am already running 
>>>>> this exercise as root
>>>>>
>>>>> I have checked system using "netstat" and "lsof" and port 50051 is not 
>>>>> used by any process.
>>>>>
>>>>> can you help me in running this quick start example without any errors.
>>>>>
>>>>> thank you
>>>>> Ankit
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/eefa4cd8-ec46-41e8-b10e-83552b999bf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to