ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ImportError: No module named bson when trying to launch a websocket test with rosbridge

asked 2020-07-30 12:09:57 -0600

RayROS gravatar image

I have been trying to get started with roslibjs to create a web interface for my robot, but without great success. I installed first sudo-apt get install ros-melodic-rosbridge-server, went ahead and create an example folder called gui_bridge under the src folder as usual.

I created a very simple launch file as below:

websocket.launch

<launch>
  <include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch"/>
</launch>

OPened two terminals, one for roscore and the other for launching roslaunch gui_bridge websocket.launch but got the error below saying:

ImportError: No module named bson

below the terminal output:

process[rosapi-2]: started with pid [776]
2020-07-30 12:56:04-0400 [-] Log opened.
2020-07-30 12:56:04-0400 [-] Traceback (most recent call last):
2020-07-30 12:56:04-0400 [-]   File "/opt/ros/melodic/lib/rosbridge_server/rosbridge_websocket", line 48, in <module>
2020-07-30 12:56:04-0400 [-]     from rosbridge_server import ClientManager
2020-07-30 12:56:04-0400 [-]   File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbridge_server/__init__.py", line 2, in <module>
2020-07-30 12:56:04-0400 [-]     from .websocket_handler import RosbridgeWebSocket
2020-07-30 12:56:04-0400 [-]   File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbridge_server/websocket_handler.py", line 49, in <module>
2020-07-30 12:56:04-0400 [-]     from rosbridge_library.rosbridge_protocol import RosbridgeProtocol
2020-07-30 12:56:04-0400 [-]   File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbridge_library/rosbridge_protocol.py", line 34, in <module>
2020-07-30 12:56:04-0400 [-]     from rosbridge_library.protocol import Protocol
2020-07-30 12:56:04-0400 [-]   File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbridge_library/protocol.py", line 40, in <module>
2020-07-30 12:56:04-0400 [-]     from rosbridge_library.util import json, bson
2020-07-30 12:56:04-0400 [-]   File "/opt/ros/melodic/lib/python2.7/dist-packages/rosbridge_library/util/__init__.py", line 19, in <module>
2020-07-30 12:56:04-0400 [-]     import bson
2020-07-30 12:56:04-0400 [-] ImportError: No module named bson
[INFO] [1596128164.177338]: Rosapi started
[rosbridge_websocket-1] process has died [pid 775, exit code 1, cmd /opt/ros/melodic/lib/rosbridge_server/rosbridge_websocket __name:=rosbridge_websocket __log:=/home/emanuele/.ros/log/8bc5ca86-d285-11ea-ad8e-a86daa9b43e9/rosbridge_websocket-1.log].
log file: /home/emanuele/.ros/log/8bc5ca86-d285-11ea-ad8e-a86daa9b43e9/rosbridge_websocket-1*.log

After a bit of research I came across this source which advised to sudo apt-get install ros-melodic-rosbridge-suite. I did exactly that but got the same exact error.

I even try to uninstall: sudo apt remove ros-melodic-rosbridge-server and reinstall it but that didn't change the output unfortunately.

Please point to the right direction for solving this issue.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-10-15 07:07:34 -0600

lali gravatar image

I run into a similar issue, and I fixed it by first uninstalling and then installing python-bson by running sudo apt-get remove python-bson followed by 'sudo apt-get install python-bson`. Which removed rosbridge_server. I then reinstalled rosbridge and now it's working just fine.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-07-30 12:09:57 -0600

Seen: 1,583 times

Last updated: Jul 30 '20