diff --git a/doc/_pages/from_binary.md b/doc/_pages/from_binary.md index 1773c90e4aac..d10959404522 100644 --- a/doc/_pages/from_binary.md +++ b/doc/_pages/from_binary.md @@ -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 @@ -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. diff --git a/setup/BUILD.bazel b/setup/BUILD.bazel index 8e5fe09d8571..ab500a079e23 100644 --- a/setup/BUILD.bazel +++ b/setup/BUILD.bazel @@ -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", @@ -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", @@ -58,6 +59,7 @@ install_files( strip_prefix = [ "mac/binary_distribution", "ubuntu/binary_distribution", + "python", ], rename = { "share/drake/setup/install_prereqs.sh": "install_prereqs", diff --git a/setup/mac/binary_distribution/Brewfile b/setup/mac/binary_distribution/Brewfile index f09980c47396..4a70781ce393 100644 --- a/setup/mac/binary_distribution/Brewfile +++ b/setup/mac/binary_distribution/Brewfile @@ -9,7 +9,6 @@ brew 'fmt' brew 'glib' brew 'graphviz' brew 'ipopt' -brew 'numpy' brew 'pkg-config' brew 'python@3.12' brew 'spdlog' diff --git a/setup/mac/binary_distribution/install_prereqs.sh b/setup/mac/binary_distribution/install_prereqs.sh index 2a90dcdf4f9c..21b36f768dc9 100755 --- a/setup/mac/binary_distribution/install_prereqs.sh +++ b/setup/mac/binary_distribution/install_prereqs.sh @@ -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 diff --git a/setup/mac/binary_distribution/requirements.txt b/setup/mac/binary_distribution/requirements.txt deleted file mode 100644 index 08e81aad2b41..000000000000 --- a/setup/mac/binary_distribution/requirements.txt +++ /dev/null @@ -1,11 +0,0 @@ -# PyPI packages to install via pip for binary Drake distributions. - -# WARNING for Drake Developers: This list must be kept in sync with -# setup/python/pyproject.toml. - -ipywidgets -matplotlib -notebook -Pillow -pydot -PyYAML diff --git a/setup/python/pdm.lock b/setup/python/pdm.lock index 334ab2efeca3..a65631bc300d 100644 --- a/setup/python/pdm.lock +++ b/setup/python/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "test", "wheel"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:6e0102fe5ea6c29e8888d56dfc6686fb1c73a2070f8dbff0e62ced5adb76a886" +content_hash = "sha256:100ca73d9872db129fe8024b21ae233953a204b3ffc7231ac35eb9cd1fca4fab" [[metadata.targets]] requires_python = ">=3.10" diff --git a/setup/python/pyproject.toml b/setup/python/pyproject.toml index ab21a4c64b07..76ed62db058c 100644 --- a/setup/python/pyproject.toml +++ b/setup/python/pyproject.toml @@ -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",