Installation¶
PySRF is built with the meson-python
backend and ships a Cython extension (_bsum) that accelerates the inner
solver. The backend compiles this extension for you during install, so you
need a working C compiler (gcc or clang) on your system.
Cython speedup
The compiled extension gives a large speedup over the pure Python fallback. If compilation fails, PySRF still imports and runs using the Python implementation, just more slowly.
Requirements¶
- Python 3.10 or newer (development targets 3.12.4).
- A C compiler for building the Cython extension.
PySRF is not yet published on PyPI, so install it from source.
Install from source¶
Or install directly from GitHub without cloning first:
In both cases the meson-python backend compiles the _bsum Cython extension
automatically. The runtime dependencies (numpy, scipy, scikit-learn, pandas,
joblib, tqdm) are installed for you.
Editable install for development¶
For an editable install that compiles the extension into a separate build directory and keeps the source tree clean:
See the Development page for the full developer workflow, test commands, and contribution guidelines.
Verify the installation¶
To check whether the fast Cython backend is active:
Performance: multi-threaded BLAS¶
The SRF solver relies on BLAS routines (via scipy) that benefit from
multi-threading. Set OMP_NUM_THREADS before importing pysrf to enable
parallel linear algebra:
Or at the top of a script, before any imports:
With verbose=1, SRF logs the active thread count at fit time.
Next steps¶
Head to the Quick start to fit your first SRF model.