-1
$\begingroup$
shahmeet18@shahmeet18-Precision-5510:~/autoware$ colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
Starting >>> autoware_lint_common
Starting >>> autoware_auto_geometry_msgs
Starting >>> autoware_auto_mapping_msgs
Starting >>> tier4_debug_msgs
Starting >>> autoware_common_msgs
Starting >>> autoware_auto_system_msgs
Starting >>> autoware_adapi_v1_msgs
Starting >>> tier4_planning_msgs
Finished <<< autoware_lint_common [1.28s]                                                                                                                                                               
Starting >>> autoware_cmake
--- stderr: autoware_auto_geometry_msgs
Traceback (most recent call last):
  File "/opt/ros/humble/share/rosidl_generator_py/cmake/../../../lib/rosidl_generator_py/rosidl_generator_py", line 8, in <module>
    from rosidl_generator_py import generate_py
ImportError: cannot import name 'generate_py' from 'rosidl_generator_py' (/opt/ros/humble/local/lib/python3.10/dist-packages/rosidl_generator_py/__init__.py)
gmake[2]: *** [autoware_auto_geometry_msgs__py/CMakeFiles/autoware_auto_geometry_msgs__py.dir/build.make:158: rosidl_generator_py/autoware_auto_geometry_msgs/_autoware_auto_geometry_msgs_s.ep.rosidl_typesupport_fastrtps_c.c] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:590: autoware_auto_geometry_msgs__py/CMakeFiles/autoware_auto_geometry_msgs__py.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2`
---
Failed   <<< autoware_auto_geometry_msgs [1.33s, exited with code 2]
Aborted  <<< tier4_debug_msgs [1.33s]
Aborted  <<< autoware_common_msgs [1.34s]
Aborted  <<< autoware_cmake [0.08s]
Aborted  <<< autoware_auto_mapping_msgs [1.40s]                                                                                                                                        
Aborted  <<< autoware_auto_system_msgs [1.42s]
Aborted  <<< autoware_adapi_v1_msgs [1.73s]                                                                                    
Aborted  <<< tier4_planning_msgs [1.94s]                                 

Summary: 1 package finished [3.00s]
  1 package failed: autoware_auto_geometry_msgs
  7 packages aborted: autoware_adapi_v1_msgs autoware_auto_mapping_msgs autoware_auto_system_msgs autoware_cmake autoware_common_msgs tier4_debug_msgs tier4_planning_msgs
  7 packages had stderr output: autoware_adapi_v1_msgs autoware_auto_geometry_msgs autoware_auto_mapping_msgs autoware_auto_system_msgs autoware_common_msgs tier4_debug_msgs tier4_planning_msgs
  226 packages not processed

How can I rectify this?

$\endgroup$
1
  • $\begingroup$ Did you read the log? You need to locate the generate_py file $\endgroup$ Jan 26, 2023 at 17:33

1 Answer 1

1
$\begingroup$

I believe this can happen when there are multiple Python interpreters on a system. I've seen this before with Anaconda users.

Here's an issue filed previously with this exact error: https://github.com/ros2/rosidl_python/issues/168

Note that the rosidl_generator_py package is present and installed in /opt/ros/humble, but the script is having trouble finding the Python module in the same package.

The debian packages for ROS 2 are built to use the system's default Python 3 interpreter. If you have another interpreter installed on your system (take a look at which python3), you should disable it when using ROS 2 debian packages. If you wish to re-build ROS 2 using a different interpreter, please try uninstalling the debians and building all of ROS 2 from source.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.