Skip to content

Commit 91a39fc

Browse files
committed
Fix Mac install path and pin macOS deployment target to 12.0
Two unrelated Mac install/build fixes bundled: - Replace bare `pip` with `python -m pip` in install_shapeworks.sh and Installation/install_python_module.sh. On Intel Macs with Homebrew, `/usr/local/bin/pip` can shadow the conda env pip even when python resolves correctly, causing package installs (numpy<2, open3d, shapeworks Python packages) to land in the wrong interpreter and install_python_module.sh to fail with a bad shebang before it could substitute the shapeworks_py path. - Add MACOSX_DEPLOYMENT_TARGET=12.0 to both Mac workflows and the cmake invocation, and fold the target into the deps cache key to force a rebuild of cached deps. Without a pin, binaries built on macos-15 runners required macOS 15+ at dlopen (missing newer libc++ symbols like std::exception_ptr::__from_native_exception_pointer), breaking ShapeWorks on anything older than Sequoia.
1 parent 56b8df9 commit 91a39fc

4 files changed

Lines changed: 16 additions & 14 deletions

File tree

.github/workflows/build-mac-arm64.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
env:
1313
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
1414
BUILD_TYPE: Release
15+
MACOSX_DEPLOYMENT_TARGET: "12.0"
1516
SW_CLOUD_LOGIN: ${{ secrets.CLOUD_LOGIN }}
1617
CACHE_HOST: ${{ secrets.SSH_HOST }}
1718
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
@@ -55,7 +56,7 @@ jobs:
5556
uses: actions/cache/restore@v3
5657
with:
5758
path: /Users/runner/install
58-
key: ${{ runner.os }}-arm64-deps-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'python_requirements.txt', 'build_dependencies.sh') }}
59+
key: ${{ runner.os }}-arm64-deps-osx${{ env.MACOSX_DEPLOYMENT_TARGET }}-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'python_requirements.txt', 'build_dependencies.sh') }}
5960

6061
- name: Build Dependencies
6162
if: steps.cache-deps-restore.outputs.cache-hit != 'true'
@@ -67,11 +68,11 @@ jobs:
6768
uses: actions/cache/save@v3
6869
with:
6970
path: /Users/runner/install
70-
key: ${{ runner.os }}-arm64-deps-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'python_requirements.txt', 'build_dependencies.sh') }}
71+
key: ${{ runner.os }}-arm64-deps-osx${{ env.MACOSX_DEPLOYMENT_TARGET }}-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'python_requirements.txt', 'build_dependencies.sh') }}
7172

7273
- name: cmake
7374
shell: bash -l {0}
74-
run: conda activate shapeworks && mkdir build && cd build && cmake -DCMAKE_LIBTOOL=/usr/bin/libtool -DCMAKE_CXX_FLAGS="-g -Wno-enum-constexpr-conversion" -DCMAKE_PREFIX_PATH=$HOME/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPython3_ROOT_DIR:FILEPATH=${CONDA_PREFIX} -DUSE_OPENMP=OFF -DBuild_Studio=ON -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/shapeworks-install -DBUILD_DOCUMENTATION=ON -DGA_MEASUREMENT_ID=$GA_MEASUREMENT_ID -DGA_API_SECRET=$GA_API_SECRET ..
75+
run: conda activate shapeworks && mkdir build && cd build && cmake -DCMAKE_LIBTOOL=/usr/bin/libtool -DCMAKE_CXX_FLAGS="-g -Wno-enum-constexpr-conversion" -DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET -DCMAKE_PREFIX_PATH=$HOME/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPython3_ROOT_DIR:FILEPATH=${CONDA_PREFIX} -DUSE_OPENMP=OFF -DBuild_Studio=ON -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/shapeworks-install -DBUILD_DOCUMENTATION=ON -DGA_MEASUREMENT_ID=$GA_MEASUREMENT_ID -DGA_API_SECRET=$GA_API_SECRET ..
7576

7677
- name: make
7778
shell: bash -l {0}

.github/workflows/build-mac.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
env:
1313
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
1414
BUILD_TYPE: Release
15+
MACOSX_DEPLOYMENT_TARGET: "12.0"
1516
SW_CLOUD_LOGIN: ${{ secrets.CLOUD_LOGIN }}
1617
CACHE_HOST: ${{ secrets.SSH_HOST }}
1718
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}
@@ -56,7 +57,7 @@ jobs:
5657
uses: actions/cache/restore@v3
5758
with:
5859
path: /Users/runner/install
59-
key: ${{ runner.os }}-intel-deps-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'python_requirements.txt', 'build_dependencies.sh') }}
60+
key: ${{ runner.os }}-intel-deps-osx${{ env.MACOSX_DEPLOYMENT_TARGET }}-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'python_requirements.txt', 'build_dependencies.sh') }}
6061

6162
- name: Build Dependencies
6263
shell: bash -l {0}
@@ -67,11 +68,11 @@ jobs:
6768
uses: actions/cache/save@v3
6869
with:
6970
path: /Users/runner/install
70-
key: ${{ runner.os }}-intel-deps-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'python_requirements.txt', 'build_dependencies.sh') }}
71+
key: ${{ runner.os }}-intel-deps-osx${{ env.MACOSX_DEPLOYMENT_TARGET }}-${{ hashFiles('.github/workflows/gha_deps.sh', 'install_shapeworks.sh', 'python_requirements.txt', 'build_dependencies.sh') }}
7172

7273
- name: cmake
7374
shell: bash -l {0}
74-
run: conda activate shapeworks && mkdir build && cd build && cmake -DCMAKE_LIBTOOL=/usr/bin/libtool -DCMAKE_CXX_FLAGS=-g -DCMAKE_PREFIX_PATH=$HOME/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPython3_ROOT_DIR:FILEPATH=${CONDA_PREFIX} -DUSE_OPENMP=OFF -DBuild_Studio=ON -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/shapeworks-install -DBUILD_DOCUMENTATION=OFF -DGA_MEASUREMENT_ID=$GA_MEASUREMENT_ID -DGA_API_SECRET=$GA_API_SECRET ..
75+
run: conda activate shapeworks && mkdir build && cd build && cmake -DCMAKE_LIBTOOL=/usr/bin/libtool -DCMAKE_CXX_FLAGS=-g -DCMAKE_OSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET -DCMAKE_PREFIX_PATH=$HOME/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPython3_ROOT_DIR:FILEPATH=${CONDA_PREFIX} -DUSE_OPENMP=OFF -DBuild_Studio=ON -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/shapeworks-install -DBUILD_DOCUMENTATION=OFF -DGA_MEASUREMENT_ID=$GA_MEASUREMENT_ID -DGA_API_SECRET=$GA_API_SECRET ..
7576

7677
- name: make
7778
shell: bash -l {0}

Installation/install_python_module.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Ensures conda Python module is able to locate correct shapeworks_py binary module.
55

66

7-
CONDA_INSTALL_DIR=`pip show shapeworks | grep Location | awk '{print $2}'`/shapeworks
7+
CONDA_INSTALL_DIR=`python -m pip show shapeworks | grep Location | awk '{print $2}'`/shapeworks
88

99
# check if $CONDA_INSTALL_DIR is under $CONDA_PREFIX
1010
if [[ "$CONDA_INSTALL_DIR" != "$CONDA_PREFIX"* ]]; then

install_shapeworks.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ function install_conda() {
173173
if [[ $(uname -s) == "Darwin" ]] && [[ $(uname -m) == "x86_64" ]]; then
174174
# Intel Mac - use older versions with NumPy 1.x
175175
if ! python -m light_the_torch install torch==2.2.2 torchaudio==2.2.2 torchvision==0.17.2; then return 1; fi
176-
pip install "numpy<2"
176+
python -m pip install "numpy<2"
177177
else
178178
# Apple Silicon, Linux, Windows - use latest with NumPy 2.x support
179179
if ! python -m light_the_torch install torch==2.8.0 torchaudio==2.8.0 torchvision==0.23.0; then return 1; fi
@@ -183,13 +183,13 @@ function install_conda() {
183183
# open3d needs to be installed differently on each platform so it's not part of python_requirements.txt
184184
OPEN3D_INSTALLED=NO
185185
if [[ "$(uname)" == "Linux" ]]; then
186-
if pip install open3d-cpu==0.19.0; then
186+
if python -m pip install open3d-cpu==0.19.0; then
187187
OPEN3D_INSTALLED=YES
188188
else
189189
echo "WARNING: open3d-cpu could not be installed. Network analysis features will not be available."
190190
fi
191191
elif [[ "$(uname)" == "Darwin" ]]; then
192-
if pip install open3d==0.19.0; then
192+
if python -m pip install open3d==0.19.0; then
193193
OPEN3D_INSTALLED=YES
194194
if [[ "$(uname -m)" == "arm64" ]]; then
195195
pushd $CONDA_PREFIX/lib/python3.12/site-packages/open3d/cpu
@@ -202,7 +202,7 @@ function install_conda() {
202202
echo "WARNING: open3d could not be installed. Network analysis features will not be available."
203203
fi
204204
else
205-
if pip install open3d==0.19.0; then
205+
if python -m pip install open3d==0.19.0; then
206206
OPEN3D_INSTALLED=YES
207207
else
208208
echo "WARNING: open3d could not be installed. Network analysis features will not be available."
@@ -211,9 +211,9 @@ function install_conda() {
211211

212212
for package in DataAugmentationUtilsPackage DatasetUtilsPackage MONAILabelPackage DeepSSMUtilsPackage DocumentationUtilsPackage ShapeCohortGenPackage shapeworks ; do
213213
if [[ -e Python/${package}.tar.gz ]] ; then
214-
if ! pip install Python/${package}.tar.gz; then return 1; fi
214+
if ! python -m pip install Python/${package}.tar.gz; then return 1; fi
215215
else
216-
if ! pip install Python/${package}; then return 1; fi
216+
if ! python -m pip install Python/${package}; then return 1; fi
217217
fi
218218
done
219219

@@ -270,7 +270,7 @@ if install_conda; then
270270
conda list
271271

272272
echo "Pip installed packages:"
273-
pip list
273+
python -m pip list
274274

275275
conda clean -t -y
276276

0 commit comments

Comments
 (0)