WARN: venv and ROS 2 conflict.
| Action | Environment |
|---|---|
colcon build |
only with venv active |
ros2 run / ros2 launch |
only without venv (deactivate) |
touch venv/COLCON_IGNORE |
so colcon doesn’t see the venv as a package |
Make colcon ignore the venv
touch /home/aleks/git/proj/claudedrone/simulation/venv/COLCON_IGNORE
Why
ROS 2 uses its own Python (the system one), and venv wraps its own. When venv is active, ros2 sees venv’s Python, which doesn’t know about the installed ROS 2 packages. So:
- Want to build with colcon using your venv-deps → activate venv.
- Want to run with
ros2 run/launch→ deactivate venv.
COLCON_IGNORE is a marker for colcon: “don’t scan this folder, no packages here.” Otherwise colcon will find the venv’s setup.py and try to build it as a ROS package.