{"id":330,"library":"scipy","title":"SciPy","description":"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.","status":"active","version":"1.17.1","language":"python","source_language":"en","source_url":"https://github.com/scipy/scipy","tags":["scientific computing","Python","numerical methods","open source"],"install":[{"cmd":"pip install scipy","lang":"bash","label":"Install SciPy"}],"dependencies":[{"reason":"SciPy depends on NumPy for array operations and numerical computations.","package":"numpy"}],"imports":[{"note":"Ensure correct submodule import for shortest_path function.","symbol":"shortest_path","correct":"from scipy.sparse.csgraph import shortest_path"},{"note":"Ensure correct submodule import for geometric_slerp function.","symbol":"geometric_slerp","correct":"from scipy.spatial import geometric_slerp"}],"quickstart":{"code":"import numpy as np\nfrom scipy.sparse.csgraph import shortest_path\n\n# Create a sample graph as a 2D NumPy array\ngraph = np.array([[0, 1, 2], [1, 0, 0], [2, 0, 0]])\n\n# Compute the shortest path distances\ndist_matrix, predecessors = shortest_path(graph, return_predecessors=True)\n\nprint('Shortest path distance matrix:')\nprint(dist_matrix)","lang":"python","description":"This example demonstrates how to compute the shortest path distances in a graph using SciPy's sparse graph module."},"warnings":[{"fix":"Upgrade your Python installation to version 3.11 or later.","message":"SciPy 1.17.1 requires Python 3.11 or higher.","severity":"breaking","affected_versions":"1.17.1"},{"fix":"Install NumPy first using 'pip install numpy'.","message":"Ensure that NumPy is installed before SciPy, as SciPy depends on NumPy for array operations.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.17.1':25 '2026':30 '22':29 '6':39 'algebra':17 'approxim':37 'cadenc':35 'comput':9,42 'current':22 'everi':38 'februari':28 'integr':14 'interpol':15 'librari':6 'linear':16 'method':45 'modul':11 'month':40 'numer':44 'offer':10 'open':46 'optim':13 'python':5,43 'regular':33 'releas':26,34 'scientif':8,41 'scipi':1,2 'sourc':47 'statist':18 'version':23","created_at":"2026-03-28T08:31:38.494614+00:00","updated_at":"2026-04-16T21:26:08.432786+00:00","problems":[{"fix":"Ensure you have `numpy` pre-installed and use a compatible Python version for which pre-built wheels exist, or install the necessary compiler tools (e.g., build-essential on Linux, Xcode Command Line Tools on macOS, Visual C++ build tools on Windows). Often, `pip install --upgrade pip` followed by `pip install numpy scipy` resolves it.","cause":"SciPy's installation from source (which pip attempts if no pre-built wheel is available) requires a C/Fortran compiler toolchain on your system.","error":"Failed building wheel for scipy"},{"fix":"Provide better initial guesses for the parameters (`p0`), increase the maximum number of iterations (`maxfev`), or add bounds to the parameters (`bounds`).","cause":"The `scipy.optimize.curve_fit` algorithm failed to converge to a stable solution, often due to poor initial guesses, ill-conditioned data, or an unsuitable model function.","error":"Optimal parameters not found: The iteration is not making good progress, as measured by the improvement from the last ten iterations."},{"fix":"Import `interp1d` from its correct submodule: `from scipy.interpolate import interp1d`.","cause":"The `interp1d` function is part of the `scipy.interpolate` submodule, but the code attempted to access it directly from the top-level `scipy` module.","error":"AttributeError: module 'scipy' has no attribute 'interp1d'"},{"fix":"Check the input matrix for linear dependencies or near-singularities. If solving a system, consider using a pseudo-inverse (`numpy.linalg.pinv` or `scipy.linalg.pinv`) or least squares (`numpy.linalg.lstsq`) instead of direct inversion.","cause":"This error occurs when a linear algebra operation (like matrix inversion) is performed on a singular matrix, which has a determinant of zero and thus no unique inverse.","error":"scipy.linalg.LinAlgError: Singular matrix"},{"fix":"Examine the integrand for singularities or problematic points within the integration interval. If known, specify singular points using the `points` argument in `quad`, split the integral, or adjust error tolerances (`epsabs`, `epsrel`).","cause":"The `scipy.integrate.quad` function struggled to evaluate the integral, often indicating a singularity, discontinuity, or highly oscillatory behavior of the integrand within the integration range.","error":"IntegrationWarning: The integral is probably divergent, or slowly convergent."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"1.18.1","cli_name":"","cli_version":null,"type":"library","homepage":"https://scipy.org/","github":"https://github.com/scipy/scipy","docs":"https://docs.scipy.org/doc/scipy/","changelog":null,"pypi":"https://pypi.org/project/scipy/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-29","last_verified":"2026-08-27","next_check":"2026-07-29","install_tag":"verified"}}