Building from source¶
Note
If you are only trying to install SciPy, we recommend using binaries - see Installation for details on that.
Building SciPy from source requires setting up system-level dependencies (compilers, BLAS/LAPACK libraries, etc.) first, and then invoking a build. The build may be done in order to install SciPy for local usage, develop SciPy itself, or build redistributable binary packages. And it may be desired to customize aspects of how the build is done. This guide will cover all these aspects. In addition, it provides background information on how the SciPy build works, and links to up-to-date guides for generic Python build & packaging documentation that is relevant.
System-level dependencies¶
SciPy uses compiled code for speed, which means you need compilers and some other system-level (i.e, non-Python / non-PyPI) dependencies to build it on your system.
Note
If you are using Conda, you can skip the steps in this section - with the
exception of installing compilers for Windows or the Apple Developer Tools
for macOS. All other dependencies will be installed automatically by the
mamba env create -f environment.yml
command.
Building SciPy from source¶
If you want to only install SciPy from source once and not do any development
work, then the recommended way to build and install is to use pip
:
Building from source for SciPy development¶
If you want to build from source in order to work on SciPy itself, first clone the SciPy repository:
git clone https://github.com/scipy/scipy.git
git submodule update --init
Then you want to do the following:
Create a dedicated development environment (virtual environment or conda environment),
Install all needed dependencies (build, and also test, doc and optional dependencies),
Build SciPy with our
dev.py
developer interface.
Step (3) is always the same, steps (1) and (2) are different between conda and virtual environments:
To build SciPy in an activated development environment, run:
python dev.py build
This will install SciPy inside the repository (by default in a
build-install
directory). You can then run tests (python dev.py test
),
drop into IPython (python dev.py ipython
), or take other development steps
like build the html documentation or running benchmarks. The dev.py
interface is self-documenting, so please see python dev.py --help
and
python dev.py <subcommand> --help
for detailed guidance.