ROS Kinetic - How to get roslaunch rosbridge_server with venv?

asked 2019-08-27 13:49:03 -0500

Loomy gravatar image

updated 2019-08-28 02:39:58 -0500

gvdhoorn gravatar image

I have a project with venv that works just fine, but when we need to run roslaunch rosbridge_server rosbridge_websocket.launch it will result in the error below unless we deactivate venv.

process[rosbridge_websocket-2]: started with pid [10182]
process[rosapi-3]: started with pid [10183]
Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
Failed to load Python extension for LZ4 support. LZ4 compression will not be available.
registered capabilities (classes):
 - <class 'rosbridge_library.capabilities.call_service.CallService'>
 - <class 'rosbridge_library.capabilities.advertise.Advertise'>
 - <class 'rosbridge_library.capabilities.publish.Publish'>
 - <class 'rosbridge_library.capabilities.subscribe.Subscribe'>
 - <class 'rosbridge_library.capabilities.defragmentation.Defragment'>
 - <class 'rosbridge_library.capabilities.advertise_service.AdvertiseService'>
 - <class 'rosbridge_library.capabilities.service_response.ServiceResponse'>
 - <class 'rosbridge_library.capabilities.unadvertise_service.UnadvertiseService'>
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/rosbridge_server/rosbridge_websocket", line 44, in <module>
    from rosbridge_server import RosbridgeWebSocket, ClientManager
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosbridge_server/__init__.py", line 4, in <module>
    from .udp_handler import RosbridgeUdpSocket,RosbridgeUdpFactory
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosbridge_server/udp_handler.py", line 6, in <module>
    from twisted.internet.protocol import DatagramProtocol,Factory
ImportError: No module named 'twisted'

I am assuming this is because there's no module named twisted installed in the virtual environment but it is installed on my computer. Following this hypothesis, this means that making roslaunch rosbridge_server rosbridge_websocket.launch work would require to install all the dependencies that it needs in venv? How would one go to do that?

edit retag flag offensive close merge delete

Comments

Not an answer, but you might be able to get things to work by allowing the venv to import all "system site packages" at creation time. That would resolve at least the system dependencies of rosbridge_server (ie: those installed using apt during installation of the binary package).

Allowing system site packages does reduce the isolation of the venv though.

A proper approach would be to list all the dependencies of rosbridge_server and then install those into the virtual environment.

gvdhoorn gravatar imagegvdhoorn ( 2019-08-28 02:42:15 -0500 )edit