Skip to content
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

Update Protobuf Version for Compatibility #30

Open
hesic73 opened this issue Nov 4, 2024 · 1 comment
Open

Update Protobuf Version for Compatibility #30

hesic73 opened this issue Nov 4, 2024 · 1 comment

Comments

@hesic73
Copy link

hesic73 commented Nov 4, 2024

We currently build Deoxys using Protobuf 3. However, using a newer version of Protobuf in Python (e.g., protobuf==5.28.3) causes compatibility issues.

git checkout v3.13.0

$ python examples/run_deoxys_with_space_mouse.py 
Traceback (most recent call last):
  File "examples/run_deoxys_with_space_mouse.py", line 4, in <module>
    from deoxys.franka_interface import FrankaInterface
  File "/home/abrar/hsc/deoxys_control/deoxys/deoxys/franka_interface/__init__.py", line 1, in <module>
    from .franka_interface import FrankaInterface
  File "/home/abrar/hsc/deoxys_control/deoxys/deoxys/franka_interface/franka_interface.py", line 10, in <module>
    import deoxys.proto.franka_interface.franka_controller_pb2 as franka_controller_pb2
  File "/home/abrar/hsc/deoxys_control/deoxys/deoxys/proto/franka_interface/franka_controller_pb2.py", line 36, in <module>
    _descriptor.EnumValueDescriptor(
  File "/home/abrar/miniconda3/envs/hsc/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 920, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

For now, I regenerate the Python files using protoc, which seems to resolve the issue. Here’s the command I use:

python -m grpc_tools.protoc -I=proto --python_out=deoxys/proto --grpc_python_out=deoxys/proto/ proto/franka-interface/*.proto
python -m grpc_tools.protoc -I=proto --python_out=deoxys/proto --grpc_python_out=deoxys/proto proto/*.proto
@hesic73
Copy link
Author

hesic73 commented Nov 5, 2024

By the way, could you add an uninstall target in the Makefile? When I first ran

make -j build_deoxys=1

I built protobuf from source, but I used the default version (3.13.0). Now, I’d like to switch to a newer version. However, after checking out the desired protobuf version and re-running this command, it didn't update the installation as expected. The functionality is unaffected, but having an uninstall target would make it easier to manage version updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant