Ask Your Question

Revision history [back]

How to make a Catkin_ws using anaconda?

Im having an issue using the Catkin_make function when using anaconda.

I tried installing ROS-melodic desktop full and follow the installation guide and setup of the catkin_ws when using python as on the official site. However it says that it can't locate the package "catkin_pkg".

I then tried updating, installing it getting it any way i can. It seems to me that either catkin_pkg can't be found by anaconda or something. I also tried uninstalling ROS, creating an ananconda enviroment for ROS, then installing ROS there and following all the same steps. Again same error.

I made sure i got the correct path and all, the PYTHON path. which was in my env folder, then bin.

(py37ROS) ~ cd catkin_ws 
(py37ROS) catkin_ws catkin_make -DPYTHON_EXECUTABLE=/home/frederik/anaconda3/envs/py37ROS/bin/python3
Base path: /home/frederik/catkin_ws
Source space: /home/frederik/catkin_ws/src
Build space: /home/frederik/catkin_ws/build
Devel space: /home/frederik/catkin_ws/devel
Install space: /home/frederik/catkin_ws/install
#### #### Running command: "cmake /home/frederik/catkin_ws/src -DPYTHON_EXECUTABLE=/home/frederik/anaconda3/envs/py37ROS/bin/python3 -DCATKIN_DEVEL_PREFIX=/home/frederik/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/frederik/catkin_ws/install -G Unix Makefiles" in "/home/frederik/catkin_ws/build" ####
-- Using CATKIN_DEVEL_PREFIX: /home/frederik/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/melodic
-- This workspace overlays: /opt/ros/melodic
-- Found PythonInterp: /home/frederik/anaconda3/envs/py37ROS/bin/python3 (found suitable version "3.7.6", minimum required is "2") 
-- Using PYTHON_EXECUTABLE: /home/frederik/anaconda3/envs/py37ROS/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/frederik/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: /home/frederik/anaconda3/envs/py37ROS/bin/python3 (found version "3.7.6") 
-- 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(/home/frederik/anaconda3/envs/py37ROS/bin/python3
  "/opt/ros/melodic/share/catkin/cmake/parse_package_xml.py"
  "/opt/ros/melodic/share/catkin/cmake/../package.xml"
  "/home/frederik/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/frederik/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/frederik/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
(py37ROS) catkin_ws 

And then it says that catkin doesn't get installed or updated because of a missing dependency. Althought i have installed it.

(base) ~ conda activate py37ROS
(py37ROS) ~ sudo apt-get install python-catkin-pkg
[sudo] password for frederik: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-catkin-pkg is already the newest version (0.4.16-100).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
(py37ROS) ~ sudo apt-get update -y                                          
Hit:1 http://dk.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://dk.archive.ubuntu.com/ubuntu bionic-updates InRelease             
Hit:3 http://ppa.launchpad.net/daniruiz/flat-remix/ubuntu bionic InRelease     
Hit:4 http://dk.archive.ubuntu.com/ubuntu bionic-backports InRelease           
Get:5 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]    
Hit:6 http://archive.canonical.com/ubuntu bionic InRelease                     
Hit:7 http://packages.ros.org/ros/ubuntu bionic InRelease                      
Fetched 88.7 kB in 1s (111 kB/s)                   
Reading package lists... Done
(py37ROS) ~ sudo apt-get install -y catkin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 catkin : Depends: python-catkin-pkg but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
(py37ROS) ~ sudo apt-get install python-catkin-pkg
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-catkin-pkg is already the newest version (0.4.16-100).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
(py37ROS) ~ sudo apt-get install -y catkin        
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 catkin : Depends: python-catkin-pkg but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
(py37ROS) ~