Ask Your Question

mqtt_bridge's Problem

asked 2020-03-06 12:12:33 -0500

KevinZehou gravatar image

updated 2020-03-06 12:15:59 -0500

gvdhoorn gravatar image

I just installed mqtt_bridge on the ROS Melodic But when i use

roslaunch mqtt_bridge demo.launch

it always shown this problem. i have installed the python module inject

Problem is :

Traceback (most recent call last):
  File "/home/kevin/catkin_ws/src/mqtt_bridge-master/scripts/", line 5, in <module>
    from import mqtt_bridge_node
  File "/home/kevin/catkin_ws/src/mqtt_bridge-master/src/mqtt_bridge/", line 4, in <module>
    import inject
ImportError: No module named inject
[mqtt_bridge-1] process has died [pid 7778, exit code 1, cmd /home/kevin/catkin_ws/src/mqtt_bridge-master/scripts/ __name:=mqtt_bridge __log:=/home/kevin/.ros/log/2b77c57e-5fd2-11ea-bb19-f894c224a270/mqtt_bridge-1.log].
log file: /home/kevin/.ros/log/2b77c57e-5fd2-11ea-bb19-f894c224a270/mqtt_bridge-1*.log
all processes on machine have died, roslaunch will exit
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-03-08 04:41:16 -0500

Shazam gravatar image


I recently struggled with the same problem, so follow these instructions and it would get working:

1) If you have both Python 2 and Python 3 at the same system then founding the right packages in the right directories can become a big mess. What I did was use Pycharm (virtual environment) and use Python 2.7 as the interpreter when you create a new project.

2) Use the command 'python -m site' and see the defined directories to look for the required packages. For example, right now it can't find the inject package in the defined directories but the package would be installed (probably in python 3.7 directory).

3) Install the specified required versions listed in the requirements.txt packages and NOT the latest ones. Use the pip install --target=/someplace package_name.version For example, I downloaded the packages in the python2.7/sitepackages

4) Start mosquitto by just writing 'mosquitto' in a new terminal.

5) Run the roslaunch command.

6) You might also have to install the rosbridge package.

Do these steps and I believe it will get working. I spent a lot of time struggling with the same issue so hopefully it helps :)

edit flag offensive delete link more


Thank you very much for your help. I tried the steps you told, and it really works. I install the modules with the right versions which shown in the requirements. But some problems happened, i tried many ways to solve the problems but it still not work. When i install the 'bson 0.5.2' , this problems hanppened. The errors are: n"/tmp/pip-install-t42_ ev/bson/"t's flle_ - 1nL '/tmp/pip-lnstall-t42_ ev /bson/setup. py'" '"l;f-getattr(tokenlile'open'do', open)(_ file_ ); Tn"0f.close();exec(complle(code, file_ exec")' egg. info · -egg base 7tmp/plp -install-t42 ev/bson/pip-egg in cwd: /tmp/pip-install-t42_ ev/bson/ Complete output (5 Lines): File "/tmp/pip-install-t42 ev/bson/", line 8, in «module> from plp import get_ Installed_ distributions ImportError: cannot tmport name get installed _distributtons ERROR: Conmand errored out with exit status 1 ...(more)

KevinZehou gravatar image KevinZehou  ( 2020-03-08 06:42:51 -0500 )edit


Is mosquitto running? and secondly uninstall bson. Then install bson it with the specified version in the target directory of python2.7/sitepackages

Shazam gravatar image Shazam  ( 2020-03-08 07:33:35 -0500 )edit

Thank you very much for your help. It finally working. I installed 'pymongo bson' and did the steps you guide me. And there is one more problem which is: [WARN] [1583671503.426540]: Inbound TCP/IP connection failed: connection from sender terminated before handshake header received. 0 bytes were received. Please check sender for additional details.

KevinZehou gravatar image KevinZehou  ( 2020-03-08 08:15:36 -0500 )edit

Actually, I'm also facing a similar issue and trying to solve it. Can you please explain what you're trying to do and where you are sending these values through mqtt? Which web platform are you using?

Shazam gravatar image Shazam  ( 2020-03-08 08:18:08 -0500 )edit

Sure. I was just triyng to test it: Publish "hello" to /echo and see response to /back. It's not really stable and i am not sure when it happened. When i do it the first time this problem happened but when i try it again, no warning happened. I am using Ubuntu 18.04LTS, and ROS Melodic.

KevinZehou gravatar image KevinZehou  ( 2020-03-08 08:28:24 -0500 )edit

I'm glad to know it's working. Let me know if you try some application over it by connecting it to a web platform.

Shazam gravatar image Shazam  ( 2020-03-08 08:42:42 -0500 )edit

No Problem. Thanks for your help!!

KevinZehou gravatar image KevinZehou  ( 2020-03-08 08:44:21 -0500 )edit

Hi, did you build anything using this package?

Shazam gravatar image Shazam  ( 2020-06-05 02:56:19 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2020-03-06 12:12:33 -0500

Seen: 396 times

Last updated: Mar 08 '20