Installation (original) (raw)

Tip

This page assumes that you are comfortable with using a terminal and happy to learn how to use a package manager. If you are a beginner and just want to get started with SciPy as quickly as possible, check outthe beginner installation guide!

The recommended method of installing SciPy depends on your preferred workflow. The common workflows can roughly be broken down into the following categories:

To install SciPy with static type stubs, see Installing with type stubs.

Tip

Installing type stubs may be required for Integrated Development Environments (IDEs) to provide accurate type hints.

Installing with uv#

Here is a step-by-step guide to setting up a project to use SciPy, with uv, a Python package manager.

  1. Install uv following, the instructions in the uv documentation.
  2. Create a new project in a new subdirectory, by executing the following in a terminal:
uv init try-scipy
cd try-scipy

Hint

The second command changes directory into the directory of your project.

  1. Add SciPy to your project:

Note

This will automatically install Python if you don’t already have it installed!

Tip

You can install other Python libraries in the same way, e.g.

  1. Try out SciPy!

This will launch a Python interpreter session, from which you can import scipy.

See next steps in the SciPy user guide.

Note

After rebooting your computer, you’ll want to navigate to your try-scipyproject directory and execute uv run python to drop back into a Python interpreter with SciPy importable. To execute a Python script, you can use uv run myscript.py.

Read more at the uv guide to working on projects.

Installing with pixi#

If you work with non-Python packages, you may prefer to install SciPy as a Conda package, so that you can use the same workflow for packages which are not available on PyPI, the Python Package Index. Conda can manage packages in any language, so you can use it to install Python itself, compilers, and other languages.

The steps to install SciPy from conda-forge using the package management tool pixi are very similar to the steps for uv:

  1. Install pixi, following the instructions in the pixi documentation.
  2. Create a new project in a new subdirectory:
pixi init try-scipy
cd try-scipy
  1. Add SciPy to your project:
  2. Try out SciPy!

In project-based workflows, a project is a directory containing a manifest file describing the project, a lock-file describing the exact dependencies of the project, and the project’s (potentially multiple) environments.

In contrast, in environment-based workflows you install packages into an environment, which you can activate and deactivate from any directory. These workflows are well-established, but lack some reproducibility benefits of project-based workflows.

Installing with pip#

  1. Install Python.
  2. Create and activate a virtual environment with venv.
  3. Install SciPy, using pip:
python -m pip install scipy

Installing with conda#

Miniforge is the recommended way to install conda and mamba, two Conda-based environment managers. After creating an environment, you can install SciPy from conda-forge as follows:

conda install scipy # or
mamba install scipy

Installing system-wide via a system package manager#

System package managers can install the most common Python packages. They install packages for the entire computer, often use older versions, and don’t have as many available versions. They are not the recommended installation method.

Ubuntu and Debian#

Using apt-get:

sudo apt-get install python3-scipy

Fedora#

Using dnf:

sudo dnf install python3-scipy

macOS#

macOS doesn’t have a preinstalled package manager, but you can installHomebrew and use it to install SciPy (and Python itself):

A word of warning: building SciPy from source can be a nontrivial exercise. We recommend using binaries instead if those are available for your platform via one of the above methods. For details on how to build from source, seethe building from source guide in the SciPy docs.

See next steps in the SciPy user guide.

Installing with Type Stubs#

Static type stubs are available via a separate package, scipy-stubs, on PyPI and conda-forge. You can also install SciPy and scipy-stubs as a single package, via the scipy-stubs[scipy] extra on PyPI, or the scipy-typedpackage on conda-forge. To get a specific version x.y.z of SciPy (such as 1.14.1), you should install version x.y.z.*, for example:

uv add "scipy-stubs[scipy]==1.14.1.*" # or
pixi add "scipy-typed=1.15.0.*" # or
python -m pip install "scipy-stubs[scipy]" # or
conda install "scipy-typed>=1.14"

Please direct questions about static typing support tothe scipy-stubs GitHub repository.