Installation¶

pyGMM supports Python 3.10 and later versions. We recommend using the latest stable version of Python.

🚀 Quick Install

For most users, install with pip:

pip install pygmm
🔧 Development Install

For contributors and developers:

git clone https://github.com/arkottke/pygmm.git
cd pygmm
pip install -e .

Requirements¶

pyGMM requires the following packages:

Core Dependencies

  • Python 3.10+

  • NumPy

  • SciPy

  • Matplotlib

Optional Dependencies

  • pandas (for data analysis)

  • Jupyter (for notebooks)

Development Dependencies

  • pytest (testing)

  • sphinx (documentation)

  • ruff (linting)

Installation Methods¶

Install the latest stable release from PyPI:

pip install pygmm

To upgrade to the latest version:

pip install --upgrade pygmm

Install from conda-forge:

conda install -c conda-forge pygmm

Or using mamba:

mamba install -c conda-forge pygmm

For the latest development version:

pip install git+https://github.com/arkottke/pygmm.git

Or clone the repository:

git clone https://github.com/arkottke/pygmm.git
cd pygmm
pip install -e .[test,docs]

Virtual Environments¶

We strongly recommend using virtual environments to avoid conflicts:

python -m venv pygmm-env
source pygmm-env/bin/activate  # On Windows: pygmm-env\Scripts\activate
pip install pygmm
conda create -n pygmm-env python=3.11
conda activate pygmm-env
pip install pygmm

Using the modern uv package manager:

uv venv pygmm-env
source pygmm-env/bin/activate  # On Windows: pygmm-env\Scripts\activate
uv pip install pygmm

Verification¶

Test your installation:

import pygmm
print(f"pyGMM version: {pygmm.__version__}")

# Quick test
scenario = pygmm.Scenario(mag=6.0, dist_rup=10, v_s30=760)
model = pygmm.CampbellBozorgnia2014()
result = model(scenario)
print("Installation successful!")

Troubleshooting¶

Common Issues

Import Error

If you get import errors, ensure you’ve activated the correct environment:

which python  # Should point to your virtual environment
pip list      # Check if pygmm is installed

Missing Dependencies

Install missing dependencies:

pip install numpy scipy matplotlib

Permission Errors

Use --user flag or virtual environments:

pip install --user pygmm
Platform-Specific Notes

Windows

  • Use Command Prompt or PowerShell

  • Consider Windows Subsystem for Linux (WSL) for better compatibility

macOS

  • Install Xcode command line tools: xcode-select --install

  • Consider using Homebrew for Python: brew install python

Linux

  • Most distributions include Python 3.10+

  • Install development headers if building from source

Getting Help¶

If you encounter issues:

  1. Check the Examples for common usage patterns

  2. Search existing GitHub Issues

  3. Create a new issue with detailed information about your problem