Robotics StackExchange | Archived questions

No Module Named catkin.builder

I created a package inside catkinws/src folder using catkincreate_pkg command.

After writing publisher and subscriber nodes, I returned to catkinws and run catkinmake. However, I got this error:

            File "/opt/ros/melodic/bin/catkin_make", line 13, in <module>
               from catkin.builder import apply_platform_specific_defaults  # noqa: E402
               ImportError: No module named catkin.builder

I checked the folder catkin_make and line 13:

          from catkin.builder import apply_platform_specific_defaults  # noqa: E402

Asked by almacitunaberk on 2020-03-29 05:29:35 UTC

Comments

I have the some issue, did you find any solution?

Asked by Toneee on 2020-07-11 21:17:07 UTC

I have this issue too. Any news??

Asked by Alexis47 on 2020-09-25 21:42:43 UTC

Answers

I had the same issue. The first catkin_make command in a clean catkin workspace must be:

$ catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3

More details: http://wiki.ros.org/catkin/Tutorials/create_a_workspace

Asked by boand on 2020-10-12 04:44:53 UTC

Comments

Only if you are using ROS Melodic (or any other non-Python 3 version of ROS) and are trying to force Catkin to use Python 3.

Asked by gvdhoorn on 2021-10-05 03:50:16 UTC

What fixed the Issue for me was to do:

source /opt/ros/$ROS_DISTRO/setup.bash

before catkin_make

Asked by TK5000 on 2021-10-05 03:19:43 UTC

Comments

The above happens when you unset a path . Ex:

unset PYTHONPATH

You need to add a path according to your version: This fixes it.

export PYTHONPATH=$PYTHONPATH:/opt/ros/melodic/lib/python2.7/dist-packages

Asked by Nagarjun on 2023-08-02 15:09:47 UTC

Comments