Use venv for macOS when installation method is tgz #22040
Labels
component: distribution
Nightly binaries, monthly releases, docker, installation
priority: medium
type: feature request
Is your feature request related to a problem? Please describe.
When installing a binary release of Drake on macOS using the
tar.gz
download installation method (aka from_binary), Drake currently runs a pip command:drake/setup/mac/binary_distribution/install_prereqs.sh
Line 70 in 82999cb
Note that we are running the
pip3.12
command from homebrew, which means that--break-system-packages
is installing Drake's python dependencies system-wide. That is not a good idea for just to run software library someone just downloaded. They should be able to run Drake without polluting their system-wide homebrew python path.We should ensure that users always run using some kind of virtual environment, and provide good docs/code in support of that.
Links to topical end-user documentation:
Describe the solution you'd like
(1) Change anything and everything that's necessary (Drake's binary packages, Drake's install_prereqs scripts, Drake's documentation, DEE's code, DEE's documentation, etc) so that running a Drake tgz binary release on macOS does not pollute homebrew python.
(2) The
binary_distribution/Brewfile
must no longer citenumpy
, but everything else there (gcc
,[email protected]
, etc.) is satisfactory to leave alone. We still want to use Homebrew's CPython interpreter, just not any of its third-party Python libraries. Drake should always be running inside of a virtual environment.(3) The
binary_distribution/requirements.txt
must not be installed system-wide, but rather inside of a virtual environment. The documentation at https://drake.mit.edu/from_binary.html#use-as-a-python-library already has a start on this, but isn't well-matched for macOS becausepython3
might not point to homebrew python. Simply changing the documentation would be a plausible solution, but I imagine that combining these two lines ...... into just a one-liner call to
env/share/drake/setup/install_prereqs
might be less brittle (so that the python details can be scripted, instead of copy-pasted from the docs).(4) Any scripts that we provide should (as much as practical) give the user good error messages in case they make a mistake, e.g., accidentally using Apple Python, or accidentally trying to run
pip
into the/opt/homebrew
tree, etc.(5) Fix the documentation at https://github.com/RobotLocomotion/drake-external-examples/tree/main/drake_cmake_installed to promise support for macOS (and by implication then also operate correctly on both Ubuntu and macOS).
Describe alternatives you've considered
n/a
Additional context
This is a sub-task of the #8392 epic.
The text was updated successfully, but these errors were encountered: