-
Notifications
You must be signed in to change notification settings - Fork 83
Description
OpenSeesPy Native for Apple Silicon (M Series) (In-development/testing)
Introduction
A cousin majoring on CS helped me compile a native ARM64 compilation of OpenSeesPy, which uses native Apple libraries optimized for Apple Silicon Macs.
We compiled on an M3 Pro processor running Mac OS 26.1 and on Python 3.12. We uploaded a version to PyPi and we need help to test to see if it works. At the end of this message we also provide the instructions used for compilation in case someone wants to try.
🚀 Quick Installation
pip install openseespy-mac-arm🔧 Installation in Virtual Environment (Recommended)
Since this is still a work-in-progress, we recommend that you test it in a Virtual Python Environment:
# Create and activate virtual environment
python3.12 -m venv myenv
source myenv/bin/activate
# Install the package
pip install openseespy-mac-arm
# Verify installation
python -c "import openseespy.opensees as ops; print(f'✅ OpenSees {ops.version()} ready!')"📋 Requirements
- macOS: unknown. We compiled it for Mac OS 26.1.
- Apple Silicon Mac. So far, tested only on an M3 Pro.
- Python 3.12 or later
💻 Usage
The package uses the same import syntax as the official OpenSeesPy:
import openseespy.opensees as ops
# Your OpenSees code here⚠️ Known issues
Conflicts with Official Package
This package cannot be installed alongside the official openseespy package. They use the same namespace and will conflict. If you have the official package installed, uninstall it first:
pip uninstall openseespy openseespymac -y
pip install openseespy-mac-armWorking with libraries that have openseespy as prerrequisite
If you install a library that lists openseespy as prerrequisite, it will not identify the uploaded version as the official package. If you need using the library, install it after openseespy-mac-arm and use the --no-deps to avoid installing the official openseespy library. Then, install the library dependencies. Example:
pip install openseespy-mac-arm
pip install library_name --no-deps
pip install matplotlib plotly pandas # Install other dependencies as needed🐛 Troubleshooting
Some errors we have found so far are:
Segmentation Fault on Import
If you get a segmentation fault when importing, check if you have PYTHONPATH pointing to a locally compiled OpenSees build:
# Check PYTHONPATH
echo $PYTHONPATH
# If it points to a local OpenSees build, unset it temporarily
unset PYTHONPATH
# Then try importing again
python -c "import openseespy.opensees as ops; print('Success!')"Known Issue: M2 Segmentation Fault
A user with an M2 experienced segmentation faults. If this happens try:
Solution: Install Homebrew MPI libraries
brew install open-mpi
pip install openseespy-mac-arm"Module not found" Error
Ensure you're using Python 3.12 or later:
python --version🤝 Contributing
This is a community-compiled version of OpenSeesPy for Apple Silicon. The original OpenSees source code is available at https://github.com/OpenSees/OpenSees.
⭐ Support
Please, let us know of any issues you find.
Tcl version
Tcl version can be downloaded from here
I tested it using the Truss.tcl example from the OpenSees Wiki and it worked.
🔨 Compilation Instructions (Advanced)
If you want to compile OpenSees/OpenSeesPy yourself for Apple Silicon, you can follow
Prerequisites
# Install Xcode Command Line Tools
xcode-select --install
# Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install required dependencies
brew install cmake python@3.12 open-mpi libaec gccCompilation Script
Create a script file (e.g., compile_opensees.sh) with the following content:
#!/bin/bash
# Navigate to script directory
cd "$(dirname "$0")"
# Create and activate virtual environment with Python 3.12
echo "📦 Setting up virtual environment..."
python3.12 -m venv venv_opensees
source venv_opensees/bin/activate
# Clone OpenSees repository if it doesn't exist
if [ ! -d "OpenSees" ]; then
echo "📂 Cloning OpenSees repository..."
git clone https://github.com/OpenSees/OpenSees.git
fi
# Compile in Release mode with Accelerate framework
echo "⚙️ Compiling engine (Release mode + Accelerate)..."
mkdir -p OpenSees/build && cd OpenSees/build
rm -rf * # Clean build to ensure Release mode
cmake .. \
-DOpenSees_PY=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLAPACK_LIBRARIES="-framework Accelerate" \
-DBLAS_LIBRARIES="-framework Accelerate" \
-DPYTHON_EXECUTABLE=$(which python)
# Compile using all available CPU cores
make OpenSeesPy -j$(sysctl -n hw.ncpu)
# Create professional package structure
echo "🏗️ Organizing files..."
cd ..
mkdir -p openseespy/opensees
cp build/OpenSeesPy.dylib openseespy/opensees/opensees.so
echo "from .opensees import *" > openseespy/opensees/__init__.py
# Fix library path to make it relocatable
install_name_tool -id "@loader_path/opensees.so" openseespy/opensees/opensees.so
echo "✅ Compilation complete!"
echo "Binary location: $(pwd)/openseespy/opensees/opensees.so"Run the Compilation
# Make the script executable
chmod +x compile_opensees.sh
# Run the compilation
./compile_opensees.sh📝 Development
- Compiled by: Javier Andrade, Orlando Arroyo (odarroyo@uc.cl)
- Based on: OpenSees framework by Frank McKenna and contributors
- Compilation date: December 2025
Note: This is an unofficial community build. For the official OpenSeesPy package (Intel/Rosetta), visit https://openseespydoc.readthedocs.io/