ros2
build_error
ai_generated
true
PackageNotFoundError: Packages not found: ['my_package']
ID: ros2/package-not-found
90%Fix Rate
92%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 2 | active | — | — | — |
Root Cause
colcon build or ros2 run cannot locate the package. Usually the workspace is not sourced or the package name is misspelled.
genericWorkarounds
-
95% success Source the workspace overlay after building
cd ~/ros2_ws && colcon build --packages-select my_package && source install/setup.bash
-
88% success Verify package.xml <name> matches the directory name and CMakeLists project() name
-
85% success Check that the package is listed in colcon list output
cd ~/ros2_ws && colcon list | grep my_package
Dead Ends
Common approaches that don't work:
-
Re-run colcon build without sourcing the workspace first
80% fail
Building and running in the same terminal without sourcing install/setup.bash means the new package is invisible to ros2 CLI
-
Manually copy the package into /opt/ros/humble/share/
85% fail
System install paths are managed by apt; manual copies get overwritten and break dependency resolution
-
Add the package path to AMENT_PREFIX_PATH by hand
70% fail
Does not persist across terminals and masks the real issue: the workspace overlay is not sourced