Remove venv from the Python preamble and adjust pip usage - #36
Merged
Merged
Conversation
The tutorial no longer uses a Python venv. User-level pip installs now run against the system Python with --break-system-packages, which is consistent with the dqrobotics example already used in the same section and works on the target Ubuntu 24.04 (PEP 668). - installing_python.rst: drop the 'Isolate your environment with a venv' section (create/activate/deactivate) and the python3-venv apt install; adjust the dqrobotics install to drop the activate step. - python_best_practices / python_asyncio / python_packaging: remove the 'Use a venv' sections and the ros2tutorial_venv activate commands. - python_packaging: add --break-system-packages to the pip install/ uninstall commands that previously relied on the venv, and update the sample output paths to the user site-packages location. - the_canonical_build_command.rst: remove the 'active venv breaks colcon' warning (this snippet is included by many pages). - source_after_build.rst: rewrite the 'dirty state' fix to drop the venv framing while keeping the build/install/log cleanup advice. Verified: full Sphinx build still succeeds with no new warnings, and no venv/virtual-environment references remain in the rendered docs.
mmmarinho
commented
Sep 15, 2026
mmmarinho
left a comment
Owner
Author
There was a problem hiding this comment.
Trying out this year without venv as it was a constant source of confusion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes all references to
venvfrom the tutorial while keeping the Python preamble steps working.Why
The preamble currently creates/activates a
ros2tutorial_venvand routes user-levelpip installs through it. This PR drops the venv entirely. Without it, user-levelpipinstalls run against the system Python with--break-system-packages— which is consistent with thedqroboticsexample already used in the same section and works on the target Ubuntu 24.04 (PEP 668).What changed (6 files, docs only)
installing_python.rst— removed the "When you want to isolate your environment, use venv" section (create/activate/deactivate) and thepython3-venvapt install; adjusted thedqroboticsexample to drop the activate step.python_best_practices.rst,python_asyncio.rst,python_packaging.rst— removed the "Use a venv" sections and thesource ros2tutorial_venv/bin/activatecommands.python_packaging.rst— added--break-system-packagesto thepip install/uninstallcommands that previously relied on the venv, and updated the sample output paths to the user site-packages location.the_canonical_build_command.rst— removed the "colcon will not work with an active venv" warning. (This snippet is.. include::d by ~14 pages, so the warning disappears from all of them.)source_after_build.rst— rewrote the "dirty state" fix to drop the venv framing while keeping the usefulbuild/ install/ log/cleanup advice.Verification
main(no new warnings, no removed warnings; the only diff is a line-number shift on a pre-existing, unrelated warning).venv/virtual environment/ros2tutorial_venv/activate/deactivatementions in the docs.Isolate your environment with a venvanchor was only referenced by the three sections that were also removed).