0
$\begingroup$

Rosanswers logo

I am getting the following error and is unable to remove the same.

#### Running command: "make cmake_check_build_system" in "/home/csio/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/csio/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.8", 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/csio/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.8") 
-- Using Python nosetests: /usr/bin/nosetests-2.7
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/csio/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/csio/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/csio/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:320: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

Originally posted by shashi on ROS Answers with karma: 43 on 2019-12-21

Post score: 2

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Install catkin_pkg using below command

sudo apt-get install python-catkin-pkg

You have to verify that the catkin_pkg is installed into python 3 directory. If below command didn't work, try

pip3 install catkin_pkg

Make sure you have installed pip for running above command


Originally posted by Abhishekpg with karma: 195 on 2019-12-22

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by gvdhoorn on 2019-12-22:
No, please don't suggest people to use pip to install ROS Python dependencies. It's unnecessary and pip packages are not automatically updated as you circumvent the system's package manager.

There is one exception to this and that would be to install those packages for Python interpreters other than the system default.

But in that case please always mention the downsides, as it has plenty.

Comment by Abhishekpg on 2019-12-22:
Ok understood. Can you please tell how to change the python interpreter.

Comment by shashi on 2019-12-22:
On running the above suggestion, I received this error:

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/catkin_pkg' Consider using the --user option or check the permissions.

Comment by Abhishekpg on 2019-12-23:
Try adding --user at the end of the command

$\endgroup$
0
$\begingroup$

Rosanswers logo

This is most likely your problem:

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.8", minimum required is "2") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
...
-- Found PythonInterp: /usr/bin/python3 (found version "3.6.8") 

Note how it says: Python 3 is found and used.

The Debian packages provided by the ROS buildfarm for Melodic are only installed for the default system provided Python interpreter. On Ubuntu Bionic (which you are most likely running, seeing as you tagged with melodic) that would still be Python 2.

As the Python 3 interpreter is found instead, none of the required Python packages are installed for it and this results in the error you show.

You'll either have to install catkin_pkg (and a few others) for the Python 3 interpreter (using the pip3 command shown by @Abhishekpg ), 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.


Originally posted by gvdhoorn with karma: 86574 on 2019-12-22

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by shashi on 2019-12-22:
How do I make sure that Catkin uses Python 2 interpreter? Is there a workaround?

Comment by everything on 2020-12-28:
In my case, I had to install sudo apt install python-pip and sudo apt install python3-pip and it automatically chose the right pip (Python 2.7 or 3.6) during installation. Perhaps you can even leave out python3-pip installation, but it does not harm at least. See https://stackoverflow.com/questions/63448467/installing-opencv-fails-because-it-cannot-find-skbuild/65479652#65479652.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.