Installation¶
Brahe is available for both Python and Rust. Choose the installation method that best fits your workflow.
Python Installation¶
Using pip (Recommended)¶
The simplest way to install Brahe is using pip from PyPI:
This will install the latest stable release of Brahe and all required dependencies.
Optional Dependencies¶
Brahe includes optional dependencies for enhanced plotting capabilities:
Using uv (Fast Alternative)¶
uv is a fast Python package installer. To install Brahe with uv:
Verifying Installation¶
After installation, verify that Brahe is working correctly:
Building from Source (Python)¶
If you want to build Brahe from source (e.g., for development or to use unreleased features), follow these steps:
Prerequisites¶
-
Rust toolchain (required for building the native extensions):
-
Configure Rust to Use Nightly:
-
Python 3.10+ with development headers:
Building with uv (Recommended)¶
Building with pip and maturin¶
Development Installation¶
For development work, install with development dependencies:
This includes tools for: - Testing (pytest, pytest-cov) - Documentation (mkdocs, mkdocstrings) - Code quality (ruff, pre-commit) - Type stubs generation (pyo3-stubgen)
Running Tests¶
After building from source, verify everything works:
Updating Type Stubs¶
If you modify the Rust Python bindings, regenerate Python type stubs:
Rust Installation¶
To use Brahe in your Rust project, add it to your Cargo.toml:
Building the Rust Library¶
Troubleshooting¶
Common Issues¶
"Failed to build wheel" (Python) - Ensure Rust is installed: rustc --version - Update Rust: rustup update - Install Python development headers (see prerequisites above)
Import errors after installation - Verify installation: pip show brahe - Check Python version: python --version (must be 3.10+) - Try reinstalling: pip install --force-reinstall brahe
Cartopy installation fails - On Ubuntu/Debian: sudo apt-get install libgeos-dev - On macOS: brew install geos - See Cartopy installation docs
Type hints not working in IDE - Ensure type stubs are installed: ls $(python -c "import brahe; print(brahe.__path__[0])")/_brahe.pyi - If missing, regenerate: ./scripts/generate_stubs.sh (from source installation)
Getting Help¶
If you encounter issues:
- Check the GitHub Issues for similar problems
- Review the documentation
- Open a new issue with:
- Your operating system and version
- Python/Rust version
- Complete error message
- Steps to reproduce
Platform-Specific Notes¶
macOS¶
On Apple Silicon (M1/M2/M3): - Brahe builds natively for ARM64 - Ensure you have the ARM64 version of Python
Windows¶
- Install Microsoft C++ Build Tools
- Consider using WSL2 for a smoother development experience
Linux¶
Most distributions work out-of-the-box. If you encounter issues: - Install build essentials: sudo apt-get install build-essential - Ensure GEOS library is installed for Cartopy