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

Help with: Unable to import python module. "ModuleNotFoundError: No module named"

asked 2019-07-26 12:36:12 -0500

Equaltrace gravatar image

updated 2019-07-26 14:02:18 -0500

jayess gravatar image

Hi all

I know this question has been asked a lot of times, but it has been mostly relevant to when writing custom python modules and then importing them. My scenario is a bit different, I am trying to use the nmea_navsat_driver package. After cloning, it builds without any warnings/errors with catkin build. However, whenever I try to run the serial driver via. rosrun nmea_navsat_driver nmea_serial_driver _port:=/dev/ttyUSB0 _baud:=38400, I get the error

Traceback (most recent call last):
File "/home/fpbot/catkin_ws/src/nmea_navsat_driver/scripts/nmea_serial_driver", line 35, in <module> import libnmea_navsat_driver.nodes.nmea_serial_driver

ModuleNotFoundError: No module named 'libnmea_navsat_driver

This is a pretty standard package which is widely used. Regardless I have checked the requirements for importing python modules and everything seems to be aligned ros documentation. This leads me to assume that the err is on my end. But I am not able to figure it out. Kindly help.

P.S. I tried other packages which involve importing python modules. The issue was reproduced for each of those packages. Therefore, it is definitely not this particular package.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-07-26 14:06:15 -0500

jayess gravatar image

Are you sourceing your workspace? From the root of your workspace, run

source devel/setup.bash

Also, why clone and build it yourself? Are you not able to install this package using your package manager? It's available for Ubuntu using

sudo apt install ros-<ros-distro>-nmea-navsat-driver

Installing it using your package manager is the preferred method, if available of course.

edit flag offensive delete link more

Comments

Hi jayess

Thanks for the reply. My sincerest apologies for the delayed response.

Yes, I am sourcing from the root of the workspace. It just gets called from the .bashrc file

I tried installing, but that didn't work either. The main reason, I try to clone and build myself is that it allows me to the make modifications to the package if I need to. (In this particular case, no modifications were made)

I tried running the same package on a different machines and it ran successfully. It is probably my ROS or Python setup. I have tried purging and reinstalling ROS but that didn't help. Not exactly sure how to troubleshoot this anymore.

Equaltrace gravatar image Equaltrace  ( 2019-07-29 21:44:15 -0500 )edit

I'd say that if you don't need to build this package then you should install it using your package manager and avoid this problem.

jayess gravatar image jayess  ( 2019-07-29 21:53:43 -0500 )edit

@jayess I did try after installation and got the same issue. I haven't been able to access the device again, but I will try to reinstall ROS and then try again.

Equaltrace gravatar image Equaltrace  ( 2019-08-02 14:37:47 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-07-26 12:36:12 -0500

Seen: 9,205 times

Last updated: Jul 26 '19