Humble tutorial creating a workspace [closed]
Hi all,
I just started my journey to learn ROS2 and worked through the humble tutorial (I am using Ubuntu 22.04.). I tried to follow the instruction to create a workspace and everything worked fine until step 5 where this error occured.
[0.392s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
'turtlesim' is in: /opt/ros/humble
If a package in a merged underlay workspace is overridden and it installs headers, then all packages in the overlay must sort their include directories by workspace order. Failure to do so may result in build failures or undefined behavior at run time.
If the overridden package is used by another package in any underlay, then the overriding package in the overlay must be API and ABI compatible or undefined behavior at run time may occur.
If you understand the risks and want to override a package anyways, add the following to the command line:
--allow-overriding turtlesim
This may be promoted to an error in a future release of colcon-override-check.
Starting >>> turtlesim
--- stderr: turtlesim
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]: *** [turtlesim__py/CMakeFiles/turtlesim__py.dir/build.make:121: rosidl_generator_py/turtlesim/_turtlesim_s.ep.rosidl_typesupport_fastrtps_c.c] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:706: turtlesim__py/CMakeFiles/turtlesim__py.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< turtlesim [25.5s, exited with code 2]
Summary: 0 packages finished [25.7s]
1 package failed: turtlesim
1 package had stderr output: turtlesim
In one post I read, it was suggested not to source before creating a workspace, however this didn't help and I got this error. Where I noticed the issue with the "rosidl_generator_py" module.
Starting >>> turtlesim
--- stderr: turtlesim
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
ModuleNotFoundError: No module named 'rosidl_generator_py'
gmake[2]: *** [turtlesim__py/CMakeFiles/turtlesim__py.dir/build.make:121: rosidl_generator_py/turtlesim/_turtlesim_s.ep.rosidl_typesupport_fastrtps_c.c] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:706: turtlesim__py/CMakeFiles/turtlesim__py.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< turtlesim [0.37s, exited with code 2]
Summary: 0 packages finished [0.47s]
1 package failed: turtlesim
1 package had stderr output: turtlesim
After reading another post, it was possible to create a workspace as I commented the required package "rosidl_default_generators" in the CMakeLists.txt file. However, I would like to know if there is a better way to fix this problem.
[0.358s] WARNING:colcon.colcon_core.package_selection:Some selected packages are already built in one or more underlay workspaces:
'turtlesim' is in: /opt/ros/humble
If a package in a merged underlay workspace is overridden and it installs headers, then ...
Are you using environments like
conda
etc? I followed the tutorial and face no issues. Can you please execute the following command and share the output:printenv | grep PYTHONPATH
Thanks for the hint! Yes, I use anaconda. I deactivated the environment through
conda deactivate
and it solved the problem. Everything works fine now! Thanks a lot!Glad you made it work!
@ravijoshi You comment was a very nice intuition.
I don't have conda so this solution didn't work for me. But commenting out rosidl_default_generators did work, and it's good enough for me