Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use venv for macOS when installation method is tgz #22040

Open
jwnimmer-tri opened this issue Oct 15, 2024 · 0 comments
Open

Use venv for macOS when installation method is tgz #22040

jwnimmer-tri opened this issue Oct 15, 2024 · 0 comments
Assignees
Labels
component: distribution Nightly binaries, monthly releases, docker, installation priority: medium type: feature request

Comments

@jwnimmer-tri
Copy link
Collaborator

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:

pip3.12 install --break-system-packages -r "${BASH_SOURCE%/*}/requirements.txt"

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 cite numpy, 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 because python3 might not point to homebrew python. Simply changing the documentation would be a plausible solution, but I imagine that combining these two lines ...

python3 -m venv env --system-site-packages
env/share/drake/setup/install_prereqs

... 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: distribution Nightly binaries, monthly releases, docker, installation priority: medium type: feature request
Development

No branches or pull requests

3 participants