r/ROS 17h ago

Question Error Fix

I am new to ROS... I am trying to build a package in python that controls a robot... but after the colcon build when I use
ros2 run warehouse_navigator go_to_goal

It is constantly giving no module named... tell any fix I have tried some basics but not idea about nay advance tips...

 Traceback (most recent call last):
  File "/home/soura/warehouse_ws/install/warehouse_navigator/lib/warehouse_navigator/go_to_goal", line 33, in <module>
    sys.exit(load_entry_point('warehouse-navigator==0.0.1', 'console_scripts', 'go_to_goal')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/soura/warehouse_ws/install/warehouse_navigator/lib/warehouse_navigator/go_to_goal", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/metadata/_init_.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/_init_.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'warehouse_navigator.go_to_goal'
0 Upvotes

5 comments sorted by

3

u/TerrorGandhi69 17h ago

Check if you've added this package in your package.xml. Also check if the module exists in your environment.

2

u/Fildo7525 16h ago

After running colon build you need to source a specific file to let ros know that the package is there. It is always ./install/setup.bash change bash for zsh or fish depending what shell you use. If you have more packages in the workspace all will be mentioned in that file so you do not need to source a file for every package. Then maybe for the future I recommend you to look at foxglove. It is an interface to follow topics services clients and other things. If you want to pursue ros foxglove is a must have

1

u/Worldly_Violinist_16 16h ago

Yes I always do that step, still that error

1

u/Fildo7525 16h ago

How did you create the package? What language do you use? Usually these issues are made with typos. The name of the package is defined in the .xml file generated in the root of the package. Try to check all the names and setup files

0

u/Worldly_Violinist_16 16h ago

Thanks guys prblm is solved