vector-python-sdk icon indicating copy to clipboard operation
vector-python-sdk copied to clipboard

Working 3.10 install

Open TylerGubala opened this issue 3 years ago • 6 comments
trafficstars

Fixes some of the 3.10 code when creating an event (removed the loop parameter)

Adds some packages to the requirements file

TylerGubala avatar Aug 30 '22 16:08 TylerGubala

Thanks for the PR. I tested the pull request. The changes definitely get rid of loop parameter error thrown when sending any requests to Vector via the SDK. However, half of the times the requests don't get executed with the following traceback:

vector-python-sdk % python3 examples/tutorials/01_hello_world.py
11:12:59.762     connection.Connection    INFO  Connecting to <VECTOR_IP>:443 for <VECTOR_NAME> using <VECTOR_CERT_PATH>
E0901 11:13:00.483381000 123145484791808 fork_posix.cc:76]             Other threads are currently calling into gRPC, skipping fork() handlers
11:13:00.597     connection.Connection    INFO  BehaviorControl control_granted_response { }
Traceback (most recent call last):
  File "anki_vector/connection.py", line 749, in log_handler
    result = await func(*args, **kwargs)
  File "anki_vector/animation.py", line 168, in load_animation_list
    return await self._load_animation_list()
  File "anki_vector/animation.py", line 134, in _load_animation_list
    result = await self.grpc_interface.ListAnimations(req)
  File "/usr/local/lib/python3.10/site-packages/aiogrpc/channel.py", line 40, in __call__
    return await fut
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
        status = StatusCode.DEADLINE_EXCEEDED
        details = "ListAnimations request timed out"
        debug_error_string = "{"created":"@1662045186.236287000","description":"Error received from peer ipv4:<ROBOT_IP>:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"ListAnimations request timed out","grpc_status":4}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "examples/tutorials/01_hello_world.py", line 34, in <module>
    main()
  File "examples/tutorials/01_hello_world.py", line 28, in main
    with anki_vector.Robot(args.serial) as robot:
  File "anki_vector/robot.py", line 742, in __enter__
    self.connect(self.behavior_activation_timeout)
  File "anki_vector/robot.py", line 663, in connect
    anim_request = self._anim.load_animation_list()
  File "anki_vector/connection.py", line 806, in result
    return future.result()
  File "/usr/local/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/local/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "anki_vector/connection.py", line 751, in log_handler
    raise connection_error(rpc_error) from rpc_error
anki_vector.exceptions.VectorTimeoutException: StatusCode.DEADLINE_EXCEEDED: ListAnimations request timed out

Message took too long to complete.

@TylerGubala did you experience similar issues?

urastogi885 avatar Sep 01 '22 15:09 urastogi885

That I did. Not exactly sure why.

Wanted to keep the pull request small in scope to start with, and hopefully get the conversation started so I could familiarize myself with the code base.

That said, can you point me in the right direction? Where can I start looking in order to debug these timeout issues?

Thanks in advance!

On Thu, Sep 1, 2022, 11:39 AM Umang Rastogi @.***> wrote:

Thanks for the changes suggested in the PR. I tested the pull request. The changes definitely get rid of loop parameter error thrown when sending any requests to Vector via the SDK. However, half of the times the requests don't get executed due to other errors with the following traceback:

vector-python-sdk % python3 01_hello_world.py 11:12:59.762 connection.Connection INFO Connecting to <VECTOR_IP>:443 for <VECTOR_NAME> using <VECTOR_CERT_PATH> E0901 11:13:00.483381000 123145484791808 fork_posix.cc:76] Other threads are currently calling into gRPC, skipping fork() handlers 11:13:00.597 connection.Connection INFO BehaviorControl control_granted_response { } Traceback (most recent call last): File "vector-python-sdk/sdk/anki_vector/connection.py", line 749, in log_handler result = await func(args, kwargs) File "vector-python-sdk/sdk/anki_vector/animation.py", line 168, in load_animation_list return await self._load_animation_list() File "vector-python-sdk/sdk/anki_vector/animation.py", line 134, in _load_animation_list result = await self.grpc_interface.ListAnimations(req) File "/usr/local/lib/python3.10/site-packages/aiogrpc/channel.py", line 40, in call return await fut grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with: status = StatusCode.DEADLINE_EXCEEDED details = "ListAnimations request timed out" debug_error_string = @.","description":"Error received from peer ipv4:<ROBOT_IP>:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"ListAnimations request timed out","grpc_status":4}"

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "vector-python-sdk/sdk/examples/tutorials/01_hello_world.py", line 34, in main() File "vector-python-sdk/sdk/examples/tutorials/01_hello_world.py", line 28, in main with anki_vector.Robot(args.serial) as robot: File "vector-python-sdk/sdk/anki_vector/robot.py", line 742, in enter self.connect(self.behavior_activation_timeout) File "vector-python-sdk/sdk/anki_vector/robot.py", line 663, in connect anim_request = self._anim.load_animation_list() File "vector-python-sdk/sdk/anki_vector/connection.py", line 806, in result return future.result() File @./3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 458, in result return self.__get_result() File @./3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "vector-python-sdk/sdk/anki_vector/connection.py", line 751, in log_handler raise connection_error(rpc_error) from rpc_error anki_vector.exceptions.VectorTimeoutException: StatusCode.DEADLINE_EXCEEDED: ListAnimations request timed out

Message took too long to complete.

@TylerGubala https://github.com/TylerGubala did you experience similar issues?

— Reply to this email directly, view it on GitHub https://github.com/anki/vector-python-sdk/pull/52#issuecomment-1234454936, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLEYR2SJXS3QR4XF6RE3OLV4DEZRANCNFSM6AAAAAAQASSAMQ . You are receiving this because you were mentioned.Message ID: @.***>

TylerGubala avatar Sep 01 '22 15:09 TylerGubala

I think similar issues exist when using the SDK with Python 3.8 and 3.9 The problem lies in how the SDK uses the Python Asyncio library to execute concurrent tasks. There have been changes in the Asyncio library since Python 3.6 and we are still trying to adapt the SDK to those changes.

urastogi885 avatar Sep 01 '22 15:09 urastogi885

In order to assess your PR, can you provide information about the protobuf version used and how did you update the pb2 files?

urastogi885 avatar Sep 07 '22 16:09 urastogi885

Thanks for the PR. I tested the pull request. The changes definitely get rid of loop parameter error thrown when sending any requests to Vector via the SDK. However, half of the times the requests don't get executed with the following traceback:

vector-python-sdk % python3 examples/tutorials/01_hello_world.py
11:12:59.762     connection.Connection    INFO  Connecting to <VECTOR_IP>:443 for <VECTOR_NAME> using <VECTOR_CERT_PATH>
E0901 11:13:00.483381000 123145484791808 fork_posix.cc:76]             Other threads are currently calling into gRPC, skipping fork() handlers
11:13:00.597     connection.Connection    INFO  BehaviorControl control_granted_response { }
Traceback (most recent call last):
  File "anki_vector/connection.py", line 749, in log_handler
    result = await func(*args, **kwargs)
  File "anki_vector/animation.py", line 168, in load_animation_list
    return await self._load_animation_list()
  File "anki_vector/animation.py", line 134, in _load_animation_list
    result = await self.grpc_interface.ListAnimations(req)
  File "/usr/local/lib/python3.10/site-packages/aiogrpc/channel.py", line 40, in __call__
    return await fut
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
        status = StatusCode.DEADLINE_EXCEEDED
        details = "ListAnimations request timed out"
        debug_error_string = "{"created":"@1662045186.236287000","description":"Error received from peer ipv4:<ROBOT_IP>:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"ListAnimations request timed out","grpc_status":4}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "examples/tutorials/01_hello_world.py", line 34, in <module>
    main()
  File "examples/tutorials/01_hello_world.py", line 28, in main
    with anki_vector.Robot(args.serial) as robot:
  File "anki_vector/robot.py", line 742, in __enter__
    self.connect(self.behavior_activation_timeout)
  File "anki_vector/robot.py", line 663, in connect
    anim_request = self._anim.load_animation_list()
  File "anki_vector/connection.py", line 806, in result
    return future.result()
  File "/usr/local/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/usr/local/Cellar/[email protected]/3.10.6_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "anki_vector/connection.py", line 751, in log_handler
    raise connection_error(rpc_error) from rpc_error
anki_vector.exceptions.VectorTimeoutException: StatusCode.DEADLINE_EXCEEDED: ListAnimations request timed out

Message took too long to complete.

@TylerGubala did you experience similar issues?

Also, @TylerGubala did the update of proto files reduce/remove above error thrown when executing SDK requests?

urastogi885 avatar Sep 07 '22 16:09 urastogi885

In order to assess your PR, can you provide information about the protobuf version used

I ran the following command and got the output:

py -m pip show protobuf

Name: protobuf Version: 4.21.5 Summary: Home-page: https://developers.google.com/protocol-buffers/ Author: [email protected] Author-email: [email protected] License: 3-Clause BSD License Location: d:\code\vector-python-sdk\venv\lib\site-packages Requires: Required-by: googleapis-common-protos


how did you update the pb2 files?

I downloaded protoc here

image

And placed the resulting bin and include files in the following location in the repo:

.protobuf/

image

Then I downloaded the 'extra' Google protobuf libs and placed the google/ folder at the root of the repo like so:

image

This is apparently recommended practice, though I don't love it.

Then in Visual Studio Code (my preferred IDE):

View -> Command Palette -> Tasks: Run Task -> Build protobuf files

image

Otherwise you can rebuild them from the terminal using the following command, assuming your current working directory is the root of the repo:

.protobuf/bin/protoc --python_out=. anki_vector/messaging/*.proto


Also, @TylerGubala did the update of proto files reduce/remove above error thrown when executing SDK requests?

Nope I need help with that one. Not sure why it's happening suddenly. Maybe someone at DDL has a robot and can help with what the reason for that is and all the events.EventHandler WARNING Unknown Event type that I keep getting.

TylerGubala avatar Sep 08 '22 02:09 TylerGubala