Environment
- OS: macOS Sequoia (Apple Silicon, osx-arm64)
- Shell: zsh
- ROS 2 Humble via RoboStack + Pixi
- Python: 3.12 (
.pixi/envs/humble/bin/python3.12)
- colcon-core: latest
Steps to Reproduce
- Set up a ROS 2 workspace using RoboStack via Pixi (conda-based environment)
- Run
colcon build --packages-up-to <package>
- Run
source install/setup.bash
Actual Behavior
The command silently exits without error code, but the environment is not sourced correctly. With tracing enabled, the failure is:
/path/to/.pixi/envs/humble/bin/python3.12: \
can't open file '/path/to/.pixi/envs/humble/_local_setup_util_sh.py': \
[Errno 2] No such file or directory
Expected Behavior
setup.bash should source correctly, or emit a clear error when a chained prefix does not contain _local_setup_util_sh.py.
Root Cause
install/setup.bash chains two prefixes (lines 22–26):
.pixi/envs/humble — the conda/RoboStack ROS 2 base prefix
install/ — the colcon workspace prefix
For each prefix, local_setup.bash invokes:
$_colcon_python_executable \
"$_colcon_prefix_bash_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" \
sh bash
colcon generates _local_setup_util_sh.py only in install/. When processing the first chained prefix (.pixi/envs/humble), Python looks for the file there — but it does not exist because that prefix was installed via conda/pixi, not colcon. The failure is silent because the exit code is swallowed.
Workaround
ln -sf install/_local_setup_util_sh.py .pixi/envs/humble/_local_setup_util_sh.py
ln -sf install/_local_setup_util_ps1.py .pixi/envs/humble/_local_setup_util_ps1.py
source install/setup.bash
Proposed Fix
Add a guard in local_setup.bash before invoking Python, so non-colcon prefixes are skipped gracefully:
if [ -f "$_colcon_prefix_bash_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" ]; then
_colcon_ordered_commands="$($_colcon_python_executable \
"$_colcon_prefix_bash_COLCON_CURRENT_PREFIX/_local_setup_util_sh.py" sh bash)"
fi
Related
Environment
.pixi/envs/humble/bin/python3.12)Steps to Reproduce
colcon build --packages-up-to <package>source install/setup.bashActual Behavior
The command silently exits without error code, but the environment is not sourced correctly. With tracing enabled, the failure is:
Expected Behavior
setup.bashshould source correctly, or emit a clear error when a chained prefix does not contain_local_setup_util_sh.py.Root Cause
install/setup.bashchains two prefixes (lines 22–26):.pixi/envs/humble— the conda/RoboStack ROS 2 base prefixinstall/— the colcon workspace prefixFor each prefix,
local_setup.bashinvokes:colcon generates
_local_setup_util_sh.pyonly ininstall/. When processing the first chained prefix (.pixi/envs/humble), Python looks for the file there — but it does not exist because that prefix was installed via conda/pixi, not colcon. The failure is silent because the exit code is swallowed.Workaround
ln -sf install/_local_setup_util_sh.py .pixi/envs/humble/_local_setup_util_sh.py ln -sf install/_local_setup_util_ps1.py .pixi/envs/humble/_local_setup_util_ps1.py source install/setup.bashProposed Fix
Add a guard in
local_setup.bashbefore invoking Python, so non-colcon prefixes are skipped gracefully:Related