# Invoking "cmake" failed

I am unable to solve this problem. I tried to run catkin_make command in catkin_ws directory

yograj@yograj-Inspiron-5537:~/catkin_ws$catkin_make Base path: /home/yograj/catkin_ws Source space: /home/yograj/catkin_ws/src Build space: /home/yograj/catkin_ws/build Devel space: /home/yograj/catkin_ws/devel Install space: /home/yograj/catkin_ws/install #### #### Running command: "cmake /home/yograj/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/yograj/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/yograj/catkin_ws/install -G Unix Makefiles" in "/home/yograj/catkin_ws/build" #### -- Using CATKIN_DEVEL_PREFIX: /home/yograj/catkin_ws/devel -- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic -- This workspace overlays: /opt/ros/kinetic -- Using PYTHON_EXECUTABLE: /home/yograj/anaconda2/bin/python -- Using Debian Python package layout -- Using empy: /usr/bin/empy -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/yograj/catkin_ws/build/test_results -- Found gtest sources under '/usr/src/gtest': gtests will be built -- Using Python nosetests: /usr/bin/nosetests-2.7 ImportError: "from catkin_pkg.package import parse_package" failed: No module named catkin_pkg.package Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH. CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message): execute_process(/home/yograj/anaconda2/bin/python "/opt/ros/kinetic/share/catkin/cmake/parse_package_xml.py" "/opt/ros/kinetic/share/catkin/cmake/../package.xml" "/home/yograj/catkin_ws/build/catkin/catkin_generated/version/package.cmake") returned error code 1 Call Stack (most recent call first): /opt/ros/kinetic/share/catkin/cmake/catkin_package_xml.cmake:74 (safe_execute_process) /opt/ros/kinetic/share/catkin/cmake/all.cmake:151 (_catkin_package_xml) /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include) CMakeLists.txt:52 (find_package) -- Configuring incomplete, errors occurred! See also "/home/yograj/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also "/home/yograj/catkin_ws/build/CMakeFiles/CMakeError.log". Invoking "cmake" failed  ## 5 Answers I solved this problem using the following command:- pip install -U rosdep rosinstall_generator wstool rosinstall six vcstools  • This did not take away the error No module named catkin_pkg.package in my case. Dec 14, 2020 at 20:54 catkin_create_pkg [depend1] [depend2] [depend3] - Just change the name of the package.There are some keywords that should not be used since it confuse the compiler. I first use and I had an error after compiling(catkin_make). I changed it to and it worked. Hope it helps. I found the solution by many tries. It is not guaranteed that it will help you, in my case, this helped. But why do I need to have python -m pip -V = 2.7 and be in the Python base environment in order to get rid of that error? • The standard python -m pip command after having applied sudo apt-get install python-pip under Python 2.7 seems important. python -V must be Python 2.7.17 or the like. This is probably because the catkin installer simply needs the old pip as the standard assignment, in my case in order to deal with gazebo. • By the same time it seems important that sudo apt-get install python3-pip is installed as well, which is then installed automatically under Python 3.6. • If you are in a virtual environment, the configuration of the base environment that is used by the installer is conflicting with versions that are installed in the virtual environment. This comment of a developer already in 2015 explains why 3.6 is installed even if you have another version like 3.7 or the like installed: 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 old standard 2.6 has now become 3.6; if you install with apt-get, 3.6 will likely be installed. But if you install python-pip instead of python3-pip, it will use a python 2.7 version by default. apt-get does not at all care about any python version that you already have. That would mean that one should install as much as possible with apt-get to avoid any Python version conflicts / have an independent install. And using pip should at best be clear by putting the needed python -m / python3.7 -m / ... in front. Quoting something else from 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, but that does not mean that a project that has started in 2019 supports it entirely. So better keep to python2.7 for pip and most of the installations that you do for a project that has started in 2019 and has cmake errors. Further ideas: Delete folder catkin_ws , And do it again. • Welcome to Robotics Maxneto CH kk. Thanks for your answer but we are looking for comprehensive answers that provide some explanation and context. Very short answers cannot do this, so please edit your answer to explain why it is right, ideally with citations. Answers that don't include explanations may be removed. See How to Answer for more info. – Ben May 28, 2021 at 12:32 Execute the following: $$pip install virtualenv$$ virtualenv <your name of choice, call it v>$ source <your name of choice, that is v>/bin/activate


Running catkin_make after doing the above worked for me.

• I also learned that catkin must be executed when the venv is activated, and then you start catkin in the folder where you generate the build folder. But it does not solve the issue here, I still get No module named catkin_pkg.package. Dec 14, 2020 at 20:17