How to Install SciPy in Python

In a notebook, SciPy must be installed for the Python kernel that runs its cells. SciPy is a Python library of numerical algorithms built on NumPy arrays.

I’ll show how to install SciPy into a notebook kernel and explain when to use Conda for an environment it manages.

TL;DR: Install SciPy with the Python You Run

Run python -m pip install scipy with the same Python environment that will run your code, then import scipy to verify the installation.

  • Create and activate a virtual environment for a project.
  • Use conda install scipy when the project environment is managed by Conda.
  • For notebooks, install into the Python interpreter used by the selected kernel.

What Is SciPy?

SciPy is a Python library of numerical algorithms for scientific and technical computing. It builds on NumPy arrays. Its functions cover tasks such as optimization, integration and statistics.

The installed distribution is named scipy, and Python code imports it with import scipy.

The What Is SciPy? overview covers the library’s purpose.

How to Install SciPy in a Python Environment

A project virtual environment keeps its Python packages separate from other projects. I used Python 3.14.7 to create a fresh environment, installed SciPy with pip, and checked the resulting imports in that same environment.

Step 1: Create and activate a virtual environment

Run these commands from your project directory. Activation puts the environment on the current terminal’s command path. In PowerShell, use the activation path shown in the code block.

python -m venv .venv
# macOS or Linux
source .venv/bin/activate
# Windows PowerShell: .venv\Scripts\Activate.ps1

On Windows Command Prompt, activate with .venv\Scripts\activate.bat. For scripts and automation, call the environment’s Python by its full path.

Step 2: Install SciPy with pip

Run pip through the Python interpreter you plan to use.

python -m pip install scipy

I ran that install in the new environment. It completed with SciPy 1.18.1 and NumPy 2.5.4 installed. SciPy declares NumPy as a dependency, so pip resolves a compatible NumPy package when the environment needs one.

Requirement already satisfied: scipy in ./.venv/lib/python3.14/site-packages (1.18.1)
Requirement already satisfied: numpy<2.8,>=2.0.0 in ./.venv/lib/python3.14/site-packages (from scipy) (2.5.4)
(exit code 0)
Pip confirms SciPy and NumPy are installed in the virtual environment

Step 3: Verify the import

Run a short file with the environment’s Python. The exact output below came from the verification script shown in the screenshot.

import scipy
import numpy

print(f"SciPy: {scipy.__version__}")
print(f"NumPy: {numpy.__version__}")
print(f"SciPy location: {scipy.__file__}")
.venv/bin/python check_scipy.py
SciPy: 1.18.1
NumPy: 2.5.4
SciPy location: /home/ubuntu/.cache/journaldev-article-runs/askpython-install-scipy-20261027T061100Z-08e3a97325f9/.venv/lib/python3.14/site-packages/scipy/__init__.py
Terminal output showing SciPy and NumPy versions and the SciPy import path

The version lines confirm that both imports work. The location line identifies the SciPy copy Python loaded. Check that it points inside the project environment you intended to use.

Step 4: Install with Conda when it owns the environment

For a Conda-managed project, activate its environment and install SciPy there. Conda also resolves the environment’s non-Python dependencies.

conda activate my-environment
conda install scipy

The SciPy installation guide documents Conda distributions including Miniforge and the mamba command. Keep this environment under the package manager already managing it.

Fix SciPy Import and Installation Errors

ModuleNotFoundError: No module named ‘scipy’ means the active Python cannot find the import package. Check which interpreter runs your code before reinstalling, because a successful install in a different environment does not repair the running one.

Match pip to the Python interpreter

Run pip through the exact interpreter you use for the program, then execute the same interpreter to test the import. Replace python with python3 or a full path if that is how you start your script.

python -m pip show scipy
python -c "import sys; print(sys.executable)"
python -c "import scipy; print(scipy.__version__)"

If the last command fails but pip reports SciPy installed, compare the executable path from sys.executable with the interpreter used by your editor, script or service. Install through that interpreter, or change the run configuration to use the environment where SciPy is present.

Install into the notebook kernel

Jupyter runs notebook code in a kernel, a process tied to a Python interpreter, so use the kernel’s interpreter to run pip from a cell and install SciPy where the notebook can import it.

import sys
!{sys.executable} -m pip install scipy

Restart the kernel after installation if the notebook still uses its previous process state, then try import scipy again. A requirements file can list SciPy for an environment build, but it does not by itself install the package into every notebook kernel.

Read common pip failures before changing the system

An installation error can point to a different cause from a missing import. Read the final error lines and identify whether pip failed to find a compatible file, lacked write access, or ran out of storage before choosing a fix.

SymptomLikely issueNext check
No matching distribution foundPython or platform is outside the available wheel tagsCheck Python version and architecture, then current SciPy release files
Permission deniedInstall target is not writableUse a project venv instead of changing system permissions
Failed building wheelNo compatible prebuilt wheel was selectedCheck supported Python and platform combinations, then use Conda if it fits the project
No space left on devicePackage download or temporary extraction cannot fitCheck free space before retrying and remove only files you recognize

Conclusion: Match the Install to the Interpreter

Install SciPy through the Python environment that runs your code. Then verify the import and package location. This check helps when an installation appears successful but Python still reports a missing module.

For authoritative options, use the SciPy installation guide. The SciPy Minimize example shows one use after installation.

FAQ

These answers cover the two installation choices readers commonly need to settle.

Should I use pip or Conda to install SciPy?

Use pip in a standard Python virtual environment. Use Conda when Conda manages the project environment, and avoid mixing managers without a specific reason.

Why does Python say no module named scipy after installation?

The package may have been installed into a different Python environment from the interpreter or notebook kernel running your code. Install through that interpreter and verify its executable path.

Ninad
Ninad

A Python and PHP developer turned writer out of passion. Over the last 6+ years, he has written for brands including DigitalOcean, DreamHost, Hostinger, and many others. When not working, you'll find him tinkering with open-source projects, vibe coding, or on a mountain trail, completely disconnected from tech.

Articles: 136