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

WIP: Use venv for Python dependencies (macOS) #21844

Closed
Closed
1 change: 1 addition & 0 deletions cmake/WORKSPACE.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ python_repository(
name = "python",
linux_interpreter_path = "@Python_EXECUTABLE@",
macos_interpreter_path = "@Python_EXECUTABLE@",
requirements_flavor = "build",
)

# Custom repository rules injected by CMake.
Expand Down
9 changes: 8 additions & 1 deletion setup/mac/binary_distribution/install_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
set -euxo pipefail

with_update=1
with_python_dependencies=1

while [ "${1:-}" != "" ]; do
case "$1" in
# Do NOT call brew update during execution of this script.
--without-update)
with_update=0
;;
# Do NOT install Python (pip) dependencies.
--without-python-dependencies)
with_python_dependencies=0
;;
*)
echo 'Invalid command line argument' >&2
exit 5
Expand Down Expand Up @@ -67,4 +72,6 @@ if ! command -v pip3.12 &>/dev/null; then
exit 2
fi

pip3.12 install --break-system-packages -r "${BASH_SOURCE%/*}/requirements.txt"
if [[ "${with_python_dependencies}" -eq 1 ]]; then
pip3.12 install --break-system-packages -r "${BASH_SOURCE%/*}/requirements.txt"
fi
7 changes: 7 additions & 0 deletions setup/mac/binary_distribution/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# PyPI packages to install via pip for binary Drake distributions.

# WARNING for Drake Developers: if you change this file, then you must
# regenerate the "locked" requirements files via:
#
# tools/workspace/python/venv_upgrade

ipywidgets
matplotlib
notebook
Expand Down
2 changes: 1 addition & 1 deletion setup/mac/install_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -euxo pipefail

binary_distribution_args=()
binary_distribution_args=(--without-python-dependencies)
source_distribution_args=()

while [ "${1:-}" != "" ]; do
Expand Down
11 changes: 0 additions & 11 deletions setup/mac/source_distribution/install_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,3 @@ brew bundle --file="${BASH_SOURCE%/*}/Brewfile" --no-lock
if [[ "${with_test_only}" -eq 1 ]]; then
brew bundle --file="${BASH_SOURCE%/*}/Brewfile-test-only" --no-lock
fi

if ! command -v pip3.12 &>/dev/null; then
echo 'ERROR: pip3.12 is NOT installed. The post-install step for the python@3.12 formula may have failed.' >&2
exit 2
fi

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

if [[ "${with_test_only}" -eq 1 ]]; then
pip3.12 install --break-system-packages -r "${BASH_SOURCE%/*}/requirements-test-only.txt"
fi
21 changes: 21 additions & 0 deletions setup/mac/source_distribution/requirements-build.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# PyPI packages to make available for Drake source builds.

# WARNING for Drake Developers: if you change this file, then you must
# regenerate the "locked" requirements files via:
#
# tools/workspace/python/venv_upgrade

-r ../binary_distribution/requirements.txt

# Packages that we are happy to take the most recent version any time we update.
# The versions of these packages are "locked" in the requirements-build.txt file
# and can change any time it updates. These are in addition to anything listed
# in the binary_distribution requirements.

# (None)

# The following are constrained or pinned version of packages. Typically we
# shouldn't need constraints, so anything listed here must be accompanied by
# a comment explaining the need for the constraint.

# (None)
Loading