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

catkin cmake error with ros

asked 2020-06-13 11:08:20 -0500

hiro1117 gravatar image

updated 2020-06-13 11:10:52 -0500

gvdhoorn gravatar image

Hello, everyone. I am following the tutorial here to create a workspace with catkin using python3: http://wiki.ros.org/ROS/Tutorials/Ins...

When I invoke

catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3

I get this output..

Base path: /home/ros/catkin_ws
Source space: /home/ros/catkin_ws/src
Build space: /home/ros/catkin_ws/build
Devel space: /home/ros/catkin_ws/devel
Install space: /home/ros/catkin_ws/install
####
#### Running command: "cmake /home/ros/catkin_ws/src -DPYTHON_EXECUTABLE=/usr/bin/python3 -DCATKIN_DEVEL_PREFIX=/home/ros/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/ros/catkin_ws/install -G Unix Makefiles" in "/home/ros/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/ros/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
-- This workspace overlays: /opt/ros/melodic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.9", minimum required is "2") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ros/catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.9") 
-- Using Python nosetests: /usr/bin/nosetests
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/melodic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
  execute_process(/usr/bin/python3
  "/opt/ros/melodic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/melodic/share/catkin/cmake/../package.xml"
  "/home/ros/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
  returned error code 1
Call Stack (most recent call first):
  /opt/ros/melodic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process)
  /opt/ros/melodic/share/catkin/cmake/all.cmake:168 (_catkin_package_xml)
  /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:20 (include)
  CMakeLists.txt:56 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/ros/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/ros/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

I tried anything to find a way to fix it.. and last time, I re-installed Ubuntu OS. But it's still occurred. I'm a new to ROS. Thank you for any help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-06-13 11:13:50 -0500

gvdhoorn gravatar image

updated 2020-06-15 11:41:52 -0500

You need to make sure the Python 3 interpreter you want to use has the required packages installed. If you've installed ROS using apt, only the default, system provided interpreter will have packages such as catkin_pkg installed. So any other interpreter will not be able to find them.

At the very least, you'll have to install catkin_pkg for /usr/bin/python3.

Note this is also mentioned by the page you link:

install Python pkgs yourself

If that Python interpreter was installed using apt, you should use the binary packages for catkin_pkg available through the ROS repositories as well. Provided you have those configured correctly already (because you've installed ROS already fi), you should run

sudo apt install python3-catkin-pkg

If you installed the Python 3 interpreter by building it from source, it's possible that even with the .deb package installed, catkin_pkg will not be picked up by your Python-from-source. In that case, you'll most likely have to make use of pip to install it for that interpreter. pip3 install catkin_pkg should install it in this case.

edit flag offensive delete link more

Comments

Thank you very much for your comment and help!! I just ran the code and installed catkin_pkg and it ran perfect!! Thank you so much!!

hiro1117 gravatar image hiro1117  ( 2020-06-13 11:17:49 -0500 )edit

On Ubuntu / Debian you shouldn't install Python packages with pip if there is an equivalent .deb. Simply because any new releases available from .deb won't be visible on your system since the pip package (which don't get updated automatically) will take precedence. You should pip3 uninstall catkin_pkg again and apt install python3-catkin-pkg-modules instead (the -module packages for Python 2 and 3 are side-by-side installable.

Dirk Thomas gravatar image Dirk Thomas  ( 2020-06-15 11:11:54 -0500 )edit
1

Python 3.6.9 does not appear to be a version of Python 3 on Ubuntu provided by Canonical (or at least: I cannot find it listed here: packages.ubuntu.com. Not in updates, nor in Eoan or newer).

Wouldn't the apt package only work for the system packaged version of Python 3?

That's why I suggested using pip3 in this case.


Edit: ah, it's the python3.6 package on Bionic.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-15 11:24:42 -0500 )edit
1

I've just updated my answer.

python3.6 does have its own directory under /usr/lib, but also loads the packages from/usr/lib/python3. That's the reason this can work with the.deb`.

gvdhoorn gravatar image gvdhoorn  ( 2020-06-15 11:43:05 -0500 )edit

Question Tools

Stats

Asked: 2020-06-13 11:08:20 -0500

Seen: 3,531 times

Last updated: Jun 15 '20