Unit 07 · lesson

Diagnose Python Package Failures

This is where the layers you learned earlier pay off.

ros2 run says package not found

Check:

source /opt/ros/jazzy/setup.bash
source ~/ros2_ws/install/local_setup.bash
ros2 pkg list | grep robotnix_pubsub

If the package never built/installed, sourcing cannot invent it.

Package found, executable not found

Inspect:

ros2 pkg executables robotnix_pubsub

Then inspect setup.py entry points and rebuild.

Python import error

Read the traceback. Check exact module/import names and declared dependencies.

Nodes run but listener hears nothing

Use graph evidence:

ros2 node list
ros2 topic list -t
ros2 topic info /student_chatter --verbose

Common beginner cause: publisher and subscriber use different topic names or message types.

Edited code but behavior did not change

With --symlink-install, many Python source edits are visible without a full reinstall, but packaging/entry-point changes may still require rebuilding. If uncertain, rebuild the selected package and source a clean terminal.

Diagnosis card

Symptom:
Build evidence:
Package discovery evidence:
Executable discovery evidence:
Node evidence:
Topic endpoint evidence:
Root cause:
Repair: