Development environment guide (conda)#

The instructions below assume that you have downloaded, installed, and tested the latest release of conda from either Miniforge or Mambaforge, Miniconda or Anaconda.

If you’re installing using the terminal, be sure to follow the “Next Steps” listed after the installer finishes. You might also need to restart your terminal window or enter source ~/.bash_profile for all the changes to take effect.

  1. (Optional) In a terminal window, enter conda list. This shows a list of all the Python packages that came with the distribution of Python currently installed. Note the latest released version of SciPy may be among them; this is not the development version you are going to build and will be able to modify.

    Ideally, we’d like to have both versions, and we’d like to be able to switch between the two as needed. Virtual environments can do just that. With a few keystrokes in the terminal or even the click of an icon, we can enable or disable our development version. Let’s set that up.


    If conda is not a recognized command, try restarting your terminal. If

    it is still not recognized, please see “Should I add Anaconda to the macOS or Linux PATH?” in the Anaconda FAQ.

  2. The Python-level dependencies for building SciPy will be installed as part of the conda environment creation - see environment.yml

    Note that we’re installing SciPy’s build dependencies and some other software, but not (yet) SciPy itself. Also note that you’ll need to have this virtual environment active whenever you want to work with the development version of SciPy.

    To create the environment with all dependencies and compilers, from the root of the SciPy folder, do

    conda env create -f environment.yml

    Finally, activate this new environment by doing

    conda activate scipy-dev
  3. Initialize git submodules: git submodule update --init.

  4. Build SciPy: enter python build.

    This will compile the C, C++, and Fortran code that comes with SciPy and install it in the directory you already have rather than the default location for Python packages. We installed python with Anaconda. is a script in the root directory of SciPy which can be used to execute several development tasks (see The interface for details).

  5. Test the build: enter python test -v.

    This command runs a suite of tests that make sure SciPy is working as it should, and -v activates the --verbose option to show all the test output. If the tests are successful, you now have a working development build of SciPy! You could stop here, but you would only be able to use this development build when the Python working directory is the SciPy root directory.

  6. Enter conda develop ., where . refers to the present directory. This will allow us to import the development version of SciPy in Python regardless of Python’s working directory.

  7. In a new terminal window, or after navigating to a different folder, test your setup. If you activate your virtual environment (e.g. conda activate scipy-dev) and run Python code that imports from SciPy, any changes you make to the SciPy code should be reflected when the code runs. After deactivating the virtual environment (conda deactivate), Python imports from the version of SciPy installed by your system, if any. You can also check which version of SciPy you’re using by executing in Python:

    import scipy

    If you have successfully imported a development version of SciPy, the word dev will appear in the output, e.g.: