Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Conflict between msgpack 1.0.0 and the deprecated msgpack-python #3251

Closed
wangwwno1 opened this issue Dec 28, 2020 · 4 comments
Closed

Comments

@wangwwno1
Copy link
Contributor

wangwwno1 commented Dec 28, 2020

Bug report

  • AirSim Version: a0d4d0e
  • UE/Unity version: N/A
  • autopilot version: N/A
  • OS Version: N/A

What's the issue you encountered?

This package is deprecated. Install msgpack instead.

https://pypi.org/project/msgpack-python/
When users install both msgpack and airsim they will have both msgpack and msgpack-python installed, which conflict.
Edit: After further examination, I find that this issue is related to the msgpack-rpc-python.
They have a PR to fix this msgpack-rpc/msgpack-rpc-python#23 but by 2020.12.18 it hasn't merge yet.

Settings

N/A

How can the issue be reproduced?

  1. Install airsim, then install msgpack by pip install msgpack==1.0.2 Note: install msgpack, NOT msgpack-python, and msgpack must be newer than 1.0.0 as they change the api in this version.
  2. Run the code below and you will get an error
import airsim
client = airsim.MultirotorClient()
client.ping()

Include full error message in text form

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/USER/anaconda3/envs/VeriFC/lib/python3.8/site-packages/airsim/client.py", line 44, in ping
    return self.client.call("ping")
  File "/home/USER/anaconda3/envs/VeriFC/lib/python3.8/site-packages/msgpackrpc/session.py", line 41, in call
    return self.send_request(method, args).get()
  File "/home/USER/anaconda3/envs/VeriFC/lib/python3.8/site-packages/msgpackrpc/session.py", line 51, in send_request
    self._transport.send_message([message.REQUEST, msgid, method, args])
  File "/home/USER/anaconda3/envs/VeriFC/lib/python3.8/site-packages/msgpackrpc/transport/tcp.py", line 89, in send_message
    self.connect()
  File "/home/USER/anaconda3/envs/VeriFC/lib/python3.8/site-packages/msgpackrpc/transport/tcp.py", line 98, in connect
    socket = ClientSocket(stream, self, self._encodings)
  File "/home/USER/anaconda3/envs/VeriFC/lib/python3.8/site-packages/msgpackrpc/transport/tcp.py", line 53, in __init__
    BaseSocket.__init__(self, stream, encodings)
  File "/home/USER/anaconda3/envs/VeriFC/lib/python3.8/site-packages/msgpackrpc/transport/tcp.py", line 12, in __init__
    self._packer = msgpack.Packer(encoding=encodings[0], default=lambda x: x.to_msgpack())
  File "msgpack/_packer.pyx", line 124, in msgpack._cmsgpack.Packer.__init__
TypeError: __init__() got an unexpected keyword argument 'encoding'

What's better than filing an issue? Filing a pull request :).

@ahmed-elsaharti
Copy link
Contributor

ahmed-elsaharti commented Dec 28, 2020

@wangwwno1 I tested this on a new machine and everything worked as expected when following the docs and installing msgpack-rpc-python
image

The error did appear when i tried to install msgpack. But its not what the docs recommend anyway.

Edit: To fix this, uninstall the airsim, msgpack, msgpack-python and the msgpack-rpc-python packages through:
pip uninstall airsim
pip uninstall msgpack
pip uninstall msgpack-python
pip uninstall msgpack-rpc-python
then follow the docs and reinstall the airsim and msgpack-rpc-python packages

@wangwwno1
Copy link
Contributor Author

@ahmed-elsaharti
Please install msgpack by pip install msgpack==1.0.2 and try again.
msgpack and msgpack-python are two different packages, and the latter one is deprecated.

@ahmed-elsaharti
Copy link
Contributor

ahmed-elsaharti commented Dec 28, 2020

@wangwwno1 it shouldn't matter (as far as the scope of Airsim goes) if either of those packages produces errors though as long as the one recommended in the docs works.

If you're trying to make this work just for airsim i would recommend uninstalling the packages mentioned above and installing msgpack-rpc-python which should work.

I'll also do some testing on one more machine to make sure the results are consistent.

@wangwwno1
Copy link
Contributor Author

wangwwno1 commented Dec 28, 2020

@ahmed-elsaharti
Thanks for your suggestion, but I need the Ray library to parallelize the data collection process and msgpack-python is conflict with it. I resolve this issue by:

  1. install msgpack-rpc-python in this PR Replace deprecated msgpack-python with msgpack + python3 compatibility msgpack-rpc/msgpack-rpc-python#23 and
  2. Remove argument pack_encoding="utf-8" and unpack_encoding="utf-8" in VehicleClient, which locatetd in airsim/client.py

Since msgpack v1.0.0 they have set the default encoding to utf-8 so these arguments are no longer effective.

@wangwwno1 wangwwno1 changed the title [Bug Report] msgpack-python is deprecated, use msgpack [Bug Report] Conflict between msgpack 1.0.0 and the deprecated msgpack-python Dec 28, 2020
@microsoft microsoft locked and limited conversation to collaborators Mar 22, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

3 participants