Installation¶
Install from PyPI¶
Verify the installation:
Install from Source (for development)¶
To modify the code or contribute:
- Python 3.11+
- Rust toolchain — required to compile the compute core (install Rust)
- uv — Python package manager (install uv)
git clone https://github.com/UMEP-dev/solweig.git
cd solweig
uv sync --group test --group dev # Install Python dependencies (dev + test groups)
maturin develop --release # Compile Rust extension and link it
Dependencies¶
Core geospatial dependencies are installed automatically with the package:
| Package | Purpose |
|---|---|
rasterio |
Loading/saving GeoTIFF rasters (install dependency) |
pyproj |
CRS handling and coordinate conversion (install dependency) |
affine |
Geospatial coordinate transforms (pulled in transitively by rasterio) |
geopandas |
Rasterising vector data, e.g. tree polygons to a canopy grid (optional, install separately) |
rasterio is a hard install dependency even for pure numpy-array workflows.
The alternative GDAL backend (no rasterio) exists only for running inside
QGIS, where the plugin uses the QGIS-bundled GDAL instead.
GPU Acceleration¶
SOLWEIG uses GPU acceleration (via wgpu/Metal/Vulkan) when available. No additional setup is required.
import solweig
print(f"GPU available: {solweig.is_gpu_available()}")
print(f"Backend: {solweig.get_compute_backend()}") # "gpu" or "cpu"
If no GPU is found, computation falls back to CPU. To force CPU mode:
Troubleshooting¶
maturin: command not found¶
Install via uv or pip:
Build errors on macOS¶
Ensure Xcode command line tools are installed:
import solweig fails after maturin develop¶
Ensure the same Python environment created by uv sync is active. If using uv: