Cedric Martens
Cedric Martens

Reputation: 1199

`roslaunch rosbridge_server rosbridge_websocket.launch` requires to deactivate venv

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): - - - - - - - - Traceback (most recent call last): File "/opt/ros/kinetic/lib/rosbridge_server/rosbridge_websocket", line 44, in from rosbridge_server import RosbridgeWebSocket, ClientManager File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosbridge_server/init.py", line 4, in from .udp_handler import RosbridgeUdpSocket,RosbridgeUdpFactory File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosbridge_server/udp_handler.py", line 6, in 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?

Upvotes: 0

Views: 1535

Answers (2)

Sai Raghava
Sai Raghava

Reputation: 137

just make sure the version of python you are using in venv and the environment where those packages are installed is same, if thats not the case, then you probably need to correct the python paths.

Mostly when you are running something in venv, the interpreter will only look inside that virtual environment, so when i face that issue, i just stopped using venv for ros and exported the pythonpaths or any ros module if they are installed for python3. distribution.

Upvotes: 1

JWCS
JWCS

Reputation: 1211

This is a bit late, but what version of python are you targeting with venv? I suspect it's a python 3.x, and if so, you have to setup for it. As you suspect, you're missing packages, this should be a good start (from here), adjusting the commands to suit your venv.

sudo apt-get install python3-pip python3-yaml
sudo pip3 install rospkg catkin_pkg

For more details, see the new ros wiki pages: http://wiki.ros.org/UsingPython3/IdentifyDependencies

Upvotes: 1

Related Questions