1
$\begingroup$

I created a simple publisher pkg to move around the turtle in turtlesim and getting this import error, let me know if you need any other information. Please correct me if I am doing anything wrong --> editing, formatting and presentation of this post. The error:

ros2 launch moveTurtle moveTurtle_launch_file.launch.py

                                                  
[INFO] [launch]: All log files can be found below /Users/someone/.ros/log/2024-05-06-11-07-01-173846-Sumits-MacBook-Pro.local-19494
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [moveTurtle-1]: process started with pid [19495]
[moveTurtle-1] Traceback (most recent call last):
[moveTurtle-1]   File "/Users/someone/rosTest/install/moveTurtle/lib/moveTurtle/moveTurtle", line 33, in <module>
[moveTurtle-1]     sys.exit(load_entry_point('moveTurtle==0.0.0', 'console_scripts', 'moveTurtle')())
[moveTurtle-1]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[moveTurtle-1]   File "/Users/someone/rosTest/install/moveTurtle/lib/moveTurtle/moveTurtle", line 25, in importlib_load_entry_point
[moveTurtle-1]     return next(matches).load()
[moveTurtle-1]            ^^^^^^^^^^^^^^^^^^^^
[moveTurtle-1]   File "/opt/miniconda3/envs/ros_env/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
[moveTurtle-1]     module = import_module(match.group('module'))
[moveTurtle-1]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[moveTurtle-1]   File "/opt/miniconda3/envs/ros_env/lib/python3.11/importlib/__init__.py", line 126, in import_module
[moveTurtle-1]     return _bootstrap._gcd_import(name[level:], package, level)
[moveTurtle-1]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[moveTurtle-1]   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
[moveTurtle-1]   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
[moveTurtle-1]   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
[moveTurtle-1]   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
[moveTurtle-1]   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
[moveTurtle-1]   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
[moveTurtle-1]   File "/Users/someone/rosTest/install/moveTurtle/lib/python3.11/site-packages/moveTurtle/moveTurtle.py", line 4, in <module>
[moveTurtle-1]     from geometry_msgs.msgs import Twist, Quaternion
[moveTurtle-1] ModuleNotFoundError: No module named 'geometry_msgs.msgs'
[ERROR] [moveTurtle-1]: process has died [pid 19495, exit code 1, cmd '/Users/someone/rosTest/install/moveTurtle/lib/moveTurtle/moveTurtle --ros-args'].

script:

import rclpy
import sys
from rclpy.node import Node
from geometry_msgs.msgs import Twist, Quaternion

class moveTurtle(Node):
      def __init__(self):
            super().__init__('moveTurtle')
            self.publisher_Quaternion = self.create_publisher(Quaternion, 'cmd_vel', 10)
            self.publisher_Twist = self.create_publisher(Twist, 'cmd_vel', 10)
            timer_period = 0.5
            self.timer = self.create_timer(timer_period, self.timer_callback)

      def timer_callback(self):
            msg_quaternion = Quaternion()
            msg_twist = Twist()
            msg_quaternion.x = 0.0
            msg_quaternion.y = 0.0
            msg_quaternion.z = 1.0
            msg_quaternion.w = 0.0
            self.publisher_Quaternion.publish(msg_quaternion)
            self.get_logger().info(f"Publishing {msg_quaternion} to {self.publisher_Quaternion}")

      def main(args=None):
            rclpy.init(args=args) 
            move = moveTurtle()
            rclpy.spin(move)
            move.destroy_node()
            rclpy.shutdown()

      if __name__ == "__main__":
            sys.exit(main())

I am using a launch file, edited the setup file and sourced local setup script before running. In the VS code my script has this import error where pylance can't find it. I am running python in Conda environment installed using http://robostack.github.io . I tried doing what Official Ros documentation says creating a overlay and underlay but same error.

ros2 pkg list | grep geo                                                                                 
geometry2
geometry_msgs
image_geometry
laser_geometry
tf2_geometry_msgs

Log file not sure how to read and what to make of it:(wanted to make this block collapsible :( )

[0.169s] [34mcolcon[0m [1;30mDEBUG[0m [32mCommand line arguments: ['/opt/miniconda3/envs/ros_env/bin/colcon', 'build'][0m
[0.169s] [34mcolcon[0m [1;30mDEBUG[0m [32mParsed command line arguments: Namespace(log_base=None, log_level=None, verb_name='build', build_base='build', install_base='install', merge_install=False, symlink_install=False, test_result_base=None, continue_on_error=False, executor='parallel', parallel_workers=11, event_handlers=None, ignore_user_meta=False, metas=['./colcon.meta'], base_paths=['.'], packages_ignore=None, packages_ignore_regex=None, paths=None, packages_up_to=None, packages_up_to_regex=None, packages_above=None, packages_above_and_dependencies=None, packages_above_depth=None, packages_select_by_dep=None, packages_skip_by_dep=None, packages_skip_up_to=None, packages_select_build_failed=False, packages_skip_build_finished=False, packages_select_test_failures=False, packages_skip_test_passed=False, packages_select=None, packages_skip=None, packages_select_regex=None, packages_skip_regex=None, packages_start=None, packages_end=None, cmake_args=None, cmake_target=None, cmake_target_skip_unavailable=False, cmake_clean_cache=False, cmake_clean_first=False, cmake_force_configure=False, ament_cmake_args=None, catkin_cmake_args=None, catkin_skip_building_tests=False, verb_parser=<colcon_defaults.argument_parser.defaults.DefaultArgumentsDecorator object at 0x103f05590>, verb_extension=<colcon_core.verb.build.BuildVerb object at 0x1045faa10>, main=<bound method BuildVerb.main of <colcon_core.verb.build.BuildVerb object at 0x1045faa10>>)[0m
[0.199s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(colcon_meta) check parameters
[0.199s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(recursive) check parameters
[0.200s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(ignore) check parameters
[0.200s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(path) check parameters
[0.200s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(colcon_meta) discover
[0.200s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(recursive) discover
[0.200s] [34mcolcon.colcon_core.package_discovery[0m [1;30mINFO[0m Crawling recursively for packages in '/Users/someone/rosTest'
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extensions ['ignore', 'ignore_ament_install']
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extension 'ignore'
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extension 'ignore_ament_install'
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extensions ['colcon_pkg']
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extension 'colcon_pkg'
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extensions ['colcon_meta']
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extension 'colcon_meta'
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extensions ['ros']
[0.200s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extension 'ros'
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extensions ['cmake', 'python']
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extension 'cmake'
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extension 'python'
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extensions ['python_setup_py']
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(.) by extension 'python_setup_py'
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(build) by extensions ['ignore', 'ignore_ament_install']
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(build) by extension 'ignore'
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(build) ignored
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(install) by extensions ['ignore', 'ignore_ament_install']
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(install) by extension 'ignore'
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(install) ignored
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(log) by extensions ['ignore', 'ignore_ament_install']
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(log) by extension 'ignore'
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(log) ignored
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extensions ['ignore', 'ignore_ament_install']
[0.219s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extension 'ignore'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extension 'ignore_ament_install'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extensions ['colcon_pkg']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extension 'colcon_pkg'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extensions ['colcon_meta']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extension 'colcon_meta'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extensions ['ros']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extension 'ros'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extensions ['cmake', 'python']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extension 'cmake'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extension 'python'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extensions ['python_setup_py']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src) by extension 'python_setup_py'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extensions ['ignore', 'ignore_ament_install']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extension 'ignore'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extension 'ignore_ament_install'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extensions ['colcon_pkg']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extension 'colcon_pkg'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extensions ['colcon_meta']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extension 'colcon_meta'
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extensions ['ros']
[0.220s] [34mcolcon.colcon_core.package_identification[0m [1;30mLevel 1[0m _identify(src/moveTurtle) by extension 'ros'
[0.222s] [34mcolcon.colcon_core.package_identification[0m [1;30mDEBUG[0m [32mPackage 'src/moveTurtle' with type 'ros.ament_python' and name 'moveTurtle'[0m
[0.222s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(recursive) using defaults
[0.222s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(ignore) discover
[0.222s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(ignore) using defaults
[0.222s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(path) discover
[0.222s] [34mcolcon.colcon_core.package_discovery[0m [1;30mLevel 1[0m discover_packages(path) using defaults
[0.234s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'cmake_args' from command line to 'None'
[0.234s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'cmake_target' from command line to 'None'
[0.234s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'cmake_target_skip_unavailable' from command line to 'False'
[0.234s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'cmake_clean_cache' from command line to 'False'
[0.234s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'cmake_clean_first' from command line to 'False'
[0.234s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'cmake_force_configure' from command line to 'False'
[0.235s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'ament_cmake_args' from command line to 'None'
[0.235s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'catkin_cmake_args' from command line to 'None'
[0.235s] [34mcolcon.colcon_core.verb[0m [1;30mLevel 5[0m set package 'moveTurtle' build argument 'catkin_skip_building_tests' from command line to 'False'
[0.235s] [34mcolcon.colcon_core.verb[0m [1;30mDEBUG[0m [32mBuilding package 'moveTurtle' with the following arguments: {'ament_cmake_args': None, 'build_base': '/Users/someone/rosTest/build/moveTurtle', 'catkin_cmake_args': None, 'catkin_skip_building_tests': False, 'cmake_args': None, 'cmake_clean_cache': False, 'cmake_clean_first': False, 'cmake_force_configure': False, 'cmake_target': None, 'cmake_target_skip_unavailable': False, 'install_base': '/Users/someone/rosTest/install/moveTurtle', 'merge_install': False, 'path': '/Users/someone/rosTest/src/moveTurtle', 'symlink_install': False, 'test_result_base': None}[0m
[0.235s] [34mcolcon.colcon_core.executor[0m [1;30mINFO[0m Executing jobs using 'parallel' executor
[0.235s] [34mcolcon.colcon_parallel_executor.executor.parallel[0m [1;30mDEBUG[0m [32mrun_until_complete[0m
[0.235s] [34mcolcon.colcon_ros.task.ament_python.build[0m [1;30mINFO[0m Building ROS package in '/Users/someone/rosTest/src/moveTurtle' with build type 'ament_python'
[0.235s] [34mcolcon.colcon_core.shell[0m [1;30mLevel 1[0m create_environment_hook('moveTurtle', 'ament_prefix_path')
[0.237s] [34mcolcon.colcon_core.plugin_system[0m [1;30mINFO[0m Skipping extension 'colcon_core.shell.bat': Not used on non-Windows systems
[0.237s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating environment hook '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/hook/ament_prefix_path.ps1'
[0.238s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating environment descriptor '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/hook/ament_prefix_path.dsv'
[0.238s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating environment hook '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/hook/ament_prefix_path.sh'
[0.238s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Skip shell extension 'powershell' for command environment: Not usable outside of PowerShell
[0.238s] [34mcolcon.colcon_core.shell[0m [1;30mDEBUG[0m [32mSkip shell extension 'dsv' for command environment[0m
[0.345s] [34mcolcon.colcon_core.task.python.build[0m [1;30mINFO[0m Building Python package in '/Users/someone/rosTest/src/moveTurtle'
[0.345s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Skip shell extension 'powershell' for command environment: Not usable outside of PowerShell
[0.345s] [34mcolcon.colcon_core.shell[0m [1;30mDEBUG[0m [32mSkip shell extension 'dsv' for command environment[0m
[0.653s] [34mcolcon.colcon_core.event_handler.log_command[0m [1;30mDEBUG[0m [32mInvoking command in '/Users/someone/rosTest/src/moveTurtle': CONDA_PROMPT_MODIFIER=(ros_env) PYTHONPATH=/Users/someone/rosTest/build/moveTurtle/prefix_override:/Users/someone/rosTest/install/moveTurtle/lib/python3.11/site-packages:${PYTHONPATH} SHLVL=2 _=/opt/miniconda3/envs/ros_env/bin/env /opt/miniconda3/envs/ros_env/bin/python3.11 -W ignore:setup.py install is deprecated setup.py egg_info --egg-base ../../build/moveTurtle build --build-base /Users/someone/rosTest/build/moveTurtle/build install --record /Users/someone/rosTest/build/moveTurtle/install.log --single-version-externally-managed install_data[0m
[0.863s] [34mcolcon.colcon_core.event_handler.log_command[0m [1;30mDEBUG[0m [32mInvoked command in '/Users/someone/rosTest/src/moveTurtle' returned '0': CONDA_PROMPT_MODIFIER=(ros_env) PYTHONPATH=/Users/someone/rosTest/build/moveTurtle/prefix_override:/Users/someone/rosTest/install/moveTurtle/lib/python3.11/site-packages:${PYTHONPATH} SHLVL=2 _=/opt/miniconda3/envs/ros_env/bin/env /opt/miniconda3/envs/ros_env/bin/python3.11 -W ignore:setup.py install is deprecated setup.py egg_info --egg-base ../../build/moveTurtle build --build-base /Users/someone/rosTest/build/moveTurtle/build install --record /Users/someone/rosTest/build/moveTurtle/install.log --single-version-externally-managed install_data[0m
[0.866s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m checking '/Users/someone/rosTest/install/moveTurtle' for CMake module files
[0.866s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m checking '/Users/someone/rosTest/install/moveTurtle' for CMake config files
[0.867s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m checking '/Users/someone/rosTest/install/moveTurtle/lib'
[0.867s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m checking '/Users/someone/rosTest/install/moveTurtle/bin'
[0.867s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m checking '/Users/someone/rosTest/install/moveTurtle/lib/pkgconfig/moveTurtle.pc'
[0.867s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m checking '/Users/someone/rosTest/install/moveTurtle/lib/python3.11/site-packages'
[0.867s] [34mcolcon.colcon_core.shell[0m [1;30mLevel 1[0m create_environment_hook('moveTurtle', 'pythonpath')
[0.867s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating environment hook '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/hook/pythonpath.ps1'
[0.867s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating environment descriptor '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/hook/pythonpath.dsv'
[0.867s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating environment hook '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/hook/pythonpath.sh'
[0.868s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m checking '/Users/someone/rosTest/install/moveTurtle/bin'
[0.868s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m create_environment_scripts_only(moveTurtle)
[0.868s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating package script '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/package.ps1'
[0.869s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating package descriptor '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/package.dsv'
[0.869s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating package script '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/package.sh'
[0.869s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating package script '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/package.bash'
[0.870s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating package script '/Users/someone/rosTest/install/moveTurtle/share/moveTurtle/package.zsh'
[0.870s] [34mcolcon.colcon_core.environment[0m [1;30mLevel 1[0m create_file_with_runtime_dependencies(/Users/someone/rosTest/install/moveTurtle/share/colcon-core/packages/moveTurtle)
[0.871s] [34mcolcon.colcon_parallel_executor.executor.parallel[0m [1;30mDEBUG[0m [32mclosing loop[0m
[0.871s] [34mcolcon.colcon_parallel_executor.executor.parallel[0m [1;30mDEBUG[0m [32mloop closed[0m
[0.871s] [34mcolcon.colcon_parallel_executor.executor.parallel[0m [1;30mDEBUG[0m [32mrun_until_complete finished with '0'[0m
[0.871s] [34mcolcon.colcon_core.event_reactor[0m [1;30mDEBUG[0m [32mjoining thread[0m
[0.872s] [34mcolcon.colcon_core.plugin_system[0m [1;30mINFO[0m Skipping extension 'colcon_notification.desktop_notification.notify2': 'notify2' not found
[0.872s] [34mcolcon.colcon_core.plugin_system[0m [1;30mINFO[0m Skipping extension 'colcon_notification.desktop_notification.notify_send': Not used on non-Linux systems
[0.872s] [34mcolcon.colcon_core.plugin_system[0m [1;30mINFO[0m Skipping extension 'colcon_notification.desktop_notification.win32': Not used on non-Windows systems
[0.872s] [34mcolcon.colcon_notification.desktop_notification[0m [1;30mINFO[0m Sending desktop notification using 'terminal_notifier'
[0.912s] [34mcolcon.colcon_core.event_reactor[0m [1;30mDEBUG[0m [32mjoined thread[0m
[0.912s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix script '/Users/someone/rosTest/install/local_setup.ps1'
[0.913s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix util module '/Users/someone/rosTest/install/_local_setup_util_ps1.py'
[0.914s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix chain script '/Users/someone/rosTest/install/setup.ps1'
[0.915s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix script '/Users/someone/rosTest/install/local_setup.sh'
[0.916s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix util module '/Users/someone/rosTest/install/_local_setup_util_sh.py'
[0.916s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix chain script '/Users/someone/rosTest/install/setup.sh'
[0.917s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix script '/Users/someone/rosTest/install/local_setup.bash'
[0.918s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix chain script '/Users/someone/rosTest/install/setup.bash'
[0.918s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix script '/Users/someone/rosTest/install/local_setup.zsh'
[0.919s] [34mcolcon.colcon_core.shell[0m [1;30mINFO[0m Creating prefix chain script '/Users/someone/rosTest/install/setup.zsh'

Don't know if this is a good idea but here you go this is how the official ROS and Python extensions are setup. enter image description here enter image description here enter image description here

The environment variables:

PATH=/opt/miniconda3/envs/ros_env/bin:/bin:/opt/anaconda3/bin:/opt/homebrew/bin/python3:/opt/anaconda3/bin:/opt/homebrew/bin/python3:/opt/anaconda3/bin:/opt/homebrew/bin/python3:/opt/anaconda3/bin:/opt/homebrew/bin/python3:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public
CONDA_PYTHON_EXE=/opt/miniconda3/bin/python
PYTHONPATH=/Users/someone/rosTest/install/moveTurtle/lib/python3.11/site-packages:/opt/miniconda3/envs/ros_env/lib/python311/site-packages:/opt/miniconda3/envs/ros_env/lib/python3.11/site-packages
PATH=/opt/miniconda3/envs/ros_env/bin:/bin:/opt/anaconda3/bin:/opt/homebrew/bin/python3:/opt/anaconda3/bin:/opt/homebrew/bin/python3:/opt/anaconda3/bin:/opt/homebrew/bin/python3:/opt/anaconda3/bin:/opt/homebrew/bin/python3:/Library/Frameworks/Python.framework/Versions/3.12/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public
__CFBundleIdentifier=com.microsoft.VSCode
PWD=/Users/someone/rosTest
OLDPWD=/Users/someone/rosTest
CONDA_PREFIX=/opt/miniconda3/envs/ros_env
CONDA_DEFAULT_ENV=ros_env
CONDA_PROMPT_MODIFIER=(ros_env) 
GFORTRAN=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-gfortran
FC_FOR_BUILD=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-gfortran
FFLAGS=-march=armv8.3-a -ftree-vectorize -fPIC -fno-stack-protector -O2 -pipe -isystem /opt/miniconda3/envs/ros_env/include
FORTRANFLAGS=-march=armv8.3-a -ftree-vectorize -fPIC -fno-stack-protector -O2 -pipe -isystem /opt/miniconda3/envs/ros_env/include
DEBUG_FFLAGS=-march=armv8.3-a -ftree-vectorize -fPIC -fno-stack-protector -O2 -pipe -isystem /opt/miniconda3/envs/ros_env/include -march=armv8.3-a -ftree-vectorize -fPIC -fno-stack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
DEBUG_FORTRANFLAGS=-march=armv8.3-a -ftree-vectorize -fPIC -fno-stack-protector -O2 -pipe -isystem /opt/miniconda3/envs/ros_env/include -march=armv8.3-a -ftree-vectorize -fPIC -fno-stack-protector -O2 -pipe -Og -g -Wall -Wextra -fcheck=all -fbacktrace -fimplicit-none -fvar-tracking-assignments
FC=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-gfortran
F77=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-gfortran
F90=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-gfortran
F95=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-gfortran
CC_FOR_BUILD=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-clang
OBJC_FOR_BUILD=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-clang
CFLAGS=-ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -isystem /opt/miniconda3/envs/ros_env/include
LDFLAGS=-Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/opt/miniconda3/envs/ros_env/lib -L/opt/miniconda3/envs/ros_env/lib
LDFLAGS_LD=-headerpad_max_install_names -dead_strip_dylibs -rpath /opt/miniconda3/envs/ros_env/lib -L/opt/miniconda3/envs/ros_env/lib
DEBUG_CFLAGS=-ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -Og -g -Wall -Wextra -isystem /opt/miniconda3/envs/ros_env/include
CMAKE_PREFIX_PATH=:/opt/miniconda3/envs/ros_env
CMAKE_ARGS=-DCMAKE_AR=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-ar -DCMAKE_CXX_COMPILER_AR=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-ar -DCMAKE_C_COMPILER_AR=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-ar -DCMAKE_RANLIB=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-ranlib -DCMAKE_CXX_COMPILER_RANLIB=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-ranlib -DCMAKE_C_COMPILER_RANLIB=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-ranlib -DCMAKE_LINKER=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-ld -DCMAKE_STRIP=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-strip -DCMAKE_INSTALL_NAME_TOOL=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-install_name_tool -DCMAKE_LIBTOOL=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-libtool -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
CXX_FOR_BUILD=/opt/miniconda3/envs/ros_env/bin/arm64-apple-darwin20.0.0-clang++
CXXFLAGS=-ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /opt/miniconda3/envs/ros_env/include
DEBUG_CXXFLAGS=-ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -Og -g -Wall -Wextra -isystem /opt/miniconda3/envs/ros_env/include
GSETTINGS_SCHEMA_DIR=/opt/miniconda3/envs/ros_env/share/glib-2.0/schemas
XML_CATALOG_FILES=file:///opt/miniconda3/envs/ros_env/etc/xml/catalog file:///etc/xml/catalog
PROJ_DATA=/opt/miniconda3/envs/ros_env/share/proj
AMENT_PREFIX_PATH=/Users/someone/rosTest/install/moveTurtle:/opt/miniconda3/envs/ros_env
PYTHONPATH=/Users/someone/rosTest/install/moveTurtle/lib/python3.11/site-packages:/opt/miniconda3/envs/ros_env/lib/python311/site-packages:/opt/miniconda3/envs/ros_env/lib/python3.11/site-packages
DYLD_LIBRARY_PATH=/opt/miniconda3/envs/ros_env/opt/rviz_ogre_vendor/lib
ROS_ETC_DIR=/opt/miniconda3/envs/ros_env/etc/ros
COLCON_PREFIX_PATH=/Users/someone/rosTest/install
_=/opt/miniconda3/envs/ros_env/bin/printenv
$\endgroup$

2 Answers 2

3
$\begingroup$

You have a typo in importing the msg library. Try to edit the code From

from geometry_msgs.msgs import Twist, Quaternion

to

from geometry_msgs.msg import Twist, Quaternion

It should be msg not msgs.

$\endgroup$
1
  • 1
    $\begingroup$ Thank you, I need to be patient I guess. I am getting another error now, something related to entry points, I will try to solve it on my own. $\endgroup$
    – diysumit
    Commented May 7 at 9:53
0
$\begingroup$

When creating a package in ROS2, we need to state the package dependencies for that package. It is possible that you did not specify the geometry_msgs as the dependencies argument. For example:

ros2 pkg create --build-type ament_python moveTurtle --dependencies rclpy geometry_msgs

In terms of dependency context, this will generate package.xml file in your src folder, which specifies the dependencies for your package. Open this package.xml file and check the tag depend.

...
<depend>rclpy</depend>
<depend>geometry_msgs</depend>
...

If the geometry_msgs is not there, you can just add them manually, and then rebuild the package again.

$\endgroup$
2
  • $\begingroup$ I looked at terminal history ros2 pkg create moveTurtle --build-type ament_python --dependencies rclpy geometry_msgs std_msgs $\endgroup$
    – diysumit
    Commented May 6 at 11:46
  • $\begingroup$ ``` <depend>rclpy</depend> <depend>geometry_msgs</depend> <depend>std_msgs</depend> <test_depend>ament_copyright</test_depend> <test_depend>ament_flake8</test_depend> <test_depend>ament_pep257</test_depend> <test_depend>python3-pytest</test_depend> ``` $\endgroup$
    – diysumit
    Commented May 6 at 11:48

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.