Skip to content

Commit 29e73e1

Browse files
committed
Make sympy installation non-fatal on macOS and use --break-system-packages
- Add --break-system-packages flag along with --user to comply with PEP 668 - Make sympy installation non-fatal using set +e/set -e - Since sympy is optional (tests work without it), continue even if installation fails - This fixes the externally-managed-environment error on macOS CI runners
1 parent 33a3942 commit 29e73e1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/actions/install-dependencies/action.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,17 @@ runs:
2424
## gmp and python are already installed in the latest macOS
2525
# brew install gmp
2626
# brew install python
27+
## Try to install sympy, but don't fail if it doesn't work (it's optional)
28+
## sympy is optional - tests will work without it
29+
## Use --break-system-packages with --user as recommended by PEP 668
30+
set +e # Don't exit on error
2731
if command -v pip3 &> /dev/null; then
28-
pip3 install --user sympy
32+
pip3 install --user --break-system-packages sympy || echo "Warning: Failed to install sympy with pip3, continuing anyway"
2933
elif python3 -m pip --version &> /dev/null; then
30-
python3 -m pip install --user sympy
34+
python3 -m pip install --user --break-system-packages sympy || echo "Warning: Failed to install sympy with python3 -m pip, continuing anyway"
3135
else
32-
python3 -m ensurepip --upgrade || python3 -m ensurepip
33-
python3 -m pip install --user sympy
36+
python3 -m ensurepip --upgrade || python3 -m ensurepip || true
37+
python3 -m pip install --user --break-system-packages sympy || echo "Warning: Failed to install sympy, continuing anyway"
3438
fi
39+
set -e # Re-enable exit on error
3540
echo "Install Mac dependencies [DONE]"

0 commit comments

Comments
 (0)