I am a beginner at ROS, what I post here are just ideas, a bit too long text for Stack Exchange, but I see that this question is not yet solved after a long time - the accepted answer does not solve the issue in my case - which makes it possible to stand a bit against the rules, rather documenting ideas than answering clearly.
I have invested hours, no success. I could not get it to run.
I can have (and can have any time again) a running system when I just strictly follow a clear list of commands. Yet, when I installed everything again on another computer and "played around" a bit, probably introduced different Python versions, apt-get versus pip installers, different pip versions and different virtual environments and other small differences from the guide, I could not get it to run. Most promising research is https://answers.ros.org/question/204024/no-module-named-catkin_pkgpackage-on-catkin_make-w-hydro/.
ROS now supports pip3 so why installing another pip at all, that might be dangerous. Take pip3 as the pip, using pip3 install --upgrade pip
.
Or there is a completely unexpected thing like this comment of a developer at http://lists.ros.org/pipermail/ros-users/2015-October/069721.html in 2015:
The issue you're running into is that the Python that is turned on by default is a non-system Python 2.6 install which is unaffected by installing Python packages with apt-get. By using the minimal image you avoid having to deal with custom versions of Python.
The 2.6 has now become 3.6, if you install with apt-get, 3.6 will likely be installed.
apt-get
does not at all care about any python version. That would mean that we should install as much as possible with apt-get to avoid any Python version conflicts.
Quoting something else from https://answers.ros.org/question/340510/catkin_make-no-module-named-catkin_pkg/:
You'll either have to install catkin_pkg (and a few others) for the Python 3 interpreter (using the pip3 command shown by @...), or make sure Catkin uses the Python 2 interpreter.
My recommendation would be the latter, as the rest of Melodic will also have been built against Python 2. Not Python 3.
The next release of ROS 1 (Noetic) will support Python 3.
This was in 2019. In 2020, Python 3 is now supported by ROS. The idea comes up that the error is thrown when you use a python2 pip to install and then switch to python3 packages.
Just guessing from (and with further ideas):
- https://answers.ros.org/question/340510/catkin_make-no-module-named-catkin_pkg/
- https://answers.ros.org/question/204024/no-module-named-catkin_pkgpackage-on-catkin_make-w-hydro/
- https://github.com/jsk-ros-pkg/jsk_travis/issues/172 --> http://lists.ros.org/pipermail/ros-users/2015-October/069721.html
- https://stackoverflow.com/questions/55342640/invoking-cmake-failed
- https://answers.ros.org/question/348505/installing-python3-catkin-pkg-uninstalls-ros-melodic-desktop-packages/