Why is this error when trying to create workspaces in ROS?
Whenever I try to create a workspace:
~/catkin_ws$ catkin_make
It looks like this:
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/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/home/usuario/miniconda3/bin/python
"/opt/ros/kinetic/share/catkin/cmake/parse_package_xml.py"
"/opt/ros/kinetic/share/catkin/cmake/../package.xml"
"/home/usuario/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:63 (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/usuario/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/usuario/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
There seems to be a problem with catkin_pkg, but I haven't found a solution
source to share
I just installed ROS on Ubuntu 16.04, had the same problem and fixed it. The place for catkin_pkg is most likely not on your PYTHONPATH and should be added.
From the error output:
Make sure you have "catkin_pkg" installed, it is up to date and located at PYTHONPATH.
Try to find catkin_pkg and check your PYTHONPATH. catkin_pkg was not on my PYTHONPATH (probably due to other program settings), so I added it and ran catkin_make again, this time successfully.
~/catkin_ws$ locate catkin_pkg
/usr/lib/python2.7/dist-packages/catkin_pkg
~/catkin_ws$ echo $PYTHONPATH
/opt/ros/kinetic/lib/python2.7/dist-packages
To add the catkin_pkg directory to the PYTHONPATH (for this session):
~/catkin_ws$ export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
As a constant, I've added the catkin_pkg file to the PYTHONPATH in my .bashrc (you might want to back up your .bashrc file first, for example cp -p ~ / .bashrc ~ / .bashrc-ros-catkin.bak).
To do this, edit the ~ / .bashrc file (you may need to use sudo to edit this file) and add the following two lines to the end of the file:
# manually added for ROS catkin_make workspace setup
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
Save the file and run source to refresh your session:
~/catkin_ws$ source ~/.bashrc
Check your PYTHONPATH again:
~/catkin_ws$ echo $PYTHONPATH
/opt/ros/kinetic/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages
Obviously, the location of your catkin_pkg files may be different from mine, so use that path instead, adding to $ PYTHONPATH above.
Now try running catkin_make again. If you get the same error paste the output of your catkin_pkg and PYTHONPATH location here.
Cheers, SB
source to share
Are you using the Anaconda environment? This issue is quite common with Anaconda Python installations.
Try: python --version
If you see Anaconda in the output, navigate to the bashrc file with vi ~/.bashrc
and then comment out the line where anaconda is added to the path. It will be something like:
export PATH="username/anaconda2/bin:$PATH"
After that enter bashrc with source ~/.bashrc
, open a new terminal and go to your skating rink workspace. Delete the old folder and try the command again catkin_make
.
Your problem needs to be resolved.
source to share
Error output:
ImportEr error: "from package catkin_pkg.package import parse_package": module named "catkin_pkg" is missing Make sure you have installed "catkin_pkg", it is up-to-date and located on PYTHONPATH.
As mentioned above, you need to have "catkin_pkg" in your PYTHONPATH. The easiest way if you ask me is:
$ pip install catkin_pkg
source to share
In fact, when you want to use Anaconda and ROS at the same time, this error usually occurs. So first go to the file .bashrc
and comment out the anaconda path.
Export PATH="/home/gaurav/anaconda3/bin:$PATH"
.
After commenting out, navigate to the folder catkin_ws
, delete the existing folder in the folder, and create a new folder src
. Then follow three steps:
1 - $ mkdir src
2 - $ catkin_init_workspace src
3 - $ catkin_make
I like.
source to share