Ask Your Question
0

ImportError: No module named rosmaster.master_api

asked 2019-02-19 16:49:37 -0600

nsy gravatar image

updated 2019-02-22 14:57:16 -0600

gvdhoorn gravatar image

Hi,

When I run command "roscore", I face with the following error:

Traceback (most recent call last):
  File "/opt/ros/melodic/bin/roscore", line 36, in <module>
    from rosmaster.master_api import NUM_WORKERS
ImportError: No module named rosmaster.master_api

I am working with melodic Ros on ubuntu 18.04. would you please help me? what is the problem?


Edit: My default python is 2.7. I couldn't run this

from rosmaster.master_api import NUM_WORKERS

in Python 3 too.

I installed ROS by apt-get install ros-desktop-melodic-full.


Edit 2: The answers are as follow:

$ which python
/usr/bin/python
$ python --version
Python 2.7.15rc1
$ ls -al /opt/ros/melodic/lib/python2.7/dist-packages/rosmaster
ls: cannot access '/opt/ros/melodic/lib/python2.7/dist-packages/rosmaster': No such file or directory

Thanks so much

edit retag flag offensive close merge delete

Comments

1

what is the problem?

do you have Python 3 / Anaconda installed and configured that as the default Python interpreter?

How did you install ROS?

gvdhoorn gravatar imagegvdhoorn ( 2019-02-20 02:38:00 -0600 )edit

What is the output of which python, python --version and ls -al /opt/ros/melodic/lib/python2.7/dist-packages/rosmaster?

gvdhoorn gravatar imagegvdhoorn ( 2019-02-21 02:12:15 -0600 )edit

It would appear you don't have the rosmaster Python pkg.

Could you try the following?

sudo apt update
sudo apt install -y ros-melodic-rosmaster

and tell us the output?

gvdhoorn gravatar imagegvdhoorn ( 2019-02-22 14:58:24 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-02-22 15:48:41 -0600

nsy gravatar image

updated 2019-02-22 18:55:46 -0600

jayess gravatar image

I think I had two different versions of Ros. I removed all installed Ros in my system by the following command and installed it again by

apt-get install ros-melodic-desktop-full

and my problem solved.

sudo apt-get remove `apt list --installed |grep ros- |cut -d '/' -f 1 |xargs`
edit flag offensive delete link more

Comments

Which two versions? Melodic only installs on Ubuntu Bionic, and Kinetic only on Xenial. There is no overlap possible.

Unless you've build ROS from source, but that should not interfere with the Python modules (they would be the same).

gvdhoorn gravatar imagegvdhoorn ( 2019-02-23 01:40:53 -0600 )edit

at the first time, I installed Ros by running "apt-get instal ros-melodic-desktop-full ". But because of some errors in running catkin, I install catkin and some other packages from source. Indeed, I don't know what was my problem but by removing all Ros Ropackages and installing it again, it solved

nsy gravatar imagensy ( 2019-02-23 15:04:41 -0600 )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

Stats

Asked: 2019-02-19 16:49:37 -0600

Seen: 1,009 times

Last updated: Feb 22