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

Modify install_prereqs to create a venv #22477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion doc/_pages/from_binary.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Download the binary release ``*.tar.gz`` file, using one of the links above.
In the example below, we'll use ``drake.tar.gz`` to refer to it, but your
download will have a more version-specific filename.

#### Ubuntu

Create and activate the environment:

```bash
Expand All @@ -77,11 +79,32 @@ source env/bin/activate

Install dependencies within the environment:

```bash
sudo env/share/drake/setup/install_prereqs
````

Refer to [Quickstart](/installation.html#quickstart) for next steps.

#### macOS

Create the environment:

```bash
mkdir -p env
tar -xvzf drake.tar.gz -C env --strip-components=1
```

Install dependencies within the environment:

```bash
env/share/drake/setup/install_prereqs
````

(On Ubuntu, the script might ask to be run under ``sudo``.)
Activate the environment:

```bash
source env/bin/activate
```

Refer to [Quickstart](/installation.html#quickstart) for next steps.

Expand Down
6 changes: 4 additions & 2 deletions setup/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package(default_visibility = ["//visibility:public"])
# downstream projects.
exports_files([
"mac/binary_distribution/Brewfile",
"mac/binary_distribution/requirements.txt",
"mac/source_distribution/Brewfile",
"mac/source_distribution/Brewfile-doc-only",
"mac/source_distribution/Brewfile-maintainer-only",
Expand Down Expand Up @@ -44,7 +43,9 @@ install_files(
"//tools/cc_toolchain:apple": [
"mac/binary_distribution/Brewfile",
"mac/binary_distribution/install_prereqs.sh",
"mac/binary_distribution/requirements.txt",
"python/pdm.lock",
"python/pyproject.toml",
"python/requirements.txt",
],
"//tools/cc_toolchain:linux": [
"deepnote/install_nginx",
Expand All @@ -58,6 +59,7 @@ install_files(
strip_prefix = [
"mac/binary_distribution",
"ubuntu/binary_distribution",
"python",
],
rename = {
"share/drake/setup/install_prereqs.sh": "install_prereqs",
Expand Down
1 change: 0 additions & 1 deletion setup/mac/binary_distribution/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ brew 'fmt'
brew 'glib'
brew 'graphviz'
brew 'ipopt'
brew 'numpy'
brew 'pkg-config'
brew '[email protected]'
brew 'spdlog'
Expand Down
7 changes: 6 additions & 1 deletion setup/mac/binary_distribution/install_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,10 @@ if ! command -v pip3.12 &>/dev/null; then
fi

if [[ "${with_python_dependencies}" -eq 1 ]]; then
pip3.12 install --break-system-packages -r "${BASH_SOURCE%/*}/requirements.txt"
readonly setup="${BASH_SOURCE%/*}"
readonly venv_root="$(cd "${setup}/../../.." && pwd)"
python3.12 -m venv "${venv_root}"
"${venv_root}/bin/pip3" install -U -r "${setup}/requirements.txt"
"${venv_root}/bin/pdm" use -p "${setup}" -f "${venv_root}"
"${venv_root}/bin/pdm" sync -p "${setup}" --prod
fi
11 changes: 0 additions & 11 deletions setup/mac/binary_distribution/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion setup/python/pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions setup/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ name = "drake"
requires-python = ">=3.10"

# Dependencies needed to build Drake.
#
# WARNING for Drake Developers: This list must be kept in sync with
# setup/mac/binary_distribution/requirements.txt.
dependencies = [
"ipywidgets",
"matplotlib",
"notebook",
"numpy",
"Pillow",
"pydot",
"PyYAML",
Expand Down