SciPy
SciPy is a Python library for scientific computing, offering modules for optimization, integration, interpolation, linear algebra, statistics, and more. The current version is 1.17.1, released on February 22, 2026, with a regular release cadence of approximately every 6 months.
Warnings
- breaking SciPy 1.17.1 requires Python 3.11 or higher.
- gotcha Ensure that NumPy is installed before SciPy, as SciPy depends on NumPy for array operations.
Install
-
pip install scipy
Imports
- shortest_path
from scipy.sparse.csgraph import shortest_path
- geometric_slerp
from scipy.spatial import geometric_slerp
Quickstart
import numpy as np
from scipy.sparse.csgraph import shortest_path
# Create a sample graph as a 2D NumPy array
graph = np.array([[0, 1, 2], [1, 0, 0], [2, 0, 0]])
# Compute the shortest path distances
dist_matrix, predecessors = shortest_path(graph, return_predecessors=True)
print('Shortest path distance matrix:')
print(dist_matrix)