{"id":1598,"library":"oldest-supported-numpy","title":"Oldest Supported NumPy","description":"Oldest-supported-numpy is a meta-package that dynamically provides the oldest compatible NumPy version for a given Python interpreter and platform. It ensures that if a platform only gained support for NumPy wheels at a more recent version, that specific version is provided. The current version is 2023.12.21, and its release cadence is irregular, typically updated when new NumPy versions or platform support changes warrant it.","status":"active","version":"2023.12.21","language":"python","source_language":"en","source_url":"https://github.com/scipy/oldest-supported-numpy","tags":["numpy","meta-package","dependency-management","version-pinning","scipy-ecosystem"],"install":[{"cmd":"pip install oldest-supported-numpy","lang":"bash","label":"Install the meta-package"}],"dependencies":[],"imports":[],"quickstart":{"code":"import subprocess\nimport sys\n\n# Install oldest-supported-numpy, which in turn installs a specific numpy version\n# This example assumes pip is installed and available\n# In a real environment, you'd typically do 'pip install oldest-supported-numpy' once.\n# For this quickstart, we ensure numpy is uninstalled first to demonstrate the effect.\n\ntry:\n    # Uninstall numpy if present to ensure oldest-supported-numpy picks it up\n    subprocess.run([sys.executable, '-m', 'pip', 'uninstall', '-y', 'numpy'], check=True, capture_output=True)\nexcept subprocess.CalledProcessError as e:\n    # This is expected if numpy isn't installed initially\n    pass # print(f\"Uninstall failed (expected if not present): {e.stderr.decode().strip()}\")\n\n# Install oldest-supported-numpy, which will pull in a specific numpy version\nsubprocess.run([sys.executable, '-m', 'pip', 'install', 'oldest-supported-numpy'], check=True, capture_output=True)\n\n# Now, import numpy and check its version\nimport numpy as np\n\nprint(f\"NumPy version installed by oldest-supported-numpy: {np.__version__}\")\n\n# Basic NumPy usage\na = np.array([1, 2, 3])\nb = np.array([4, 5, 6])\nc = a + b\nprint(f\"Example NumPy array operation: {c}\")\n","lang":"python","description":"This quickstart demonstrates how to install `oldest-supported-numpy` and then verifies which NumPy version was installed by importing it and checking `np.__version__`. It then shows a basic NumPy operation."},"warnings":[{"fix":"Do not attempt to `import oldest_supported_numpy`. Instead, once installed, `import numpy` to use the NumPy library.","message":"The `oldest-supported-numpy` package itself does not have a Python API to import. Its sole purpose is to act as a dependency resolver, ensuring that a compatible (and often oldest-supported) version of the actual `numpy` package is installed into your environment.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always check `numpy.__version__` after installation to confirm the exact version. If you require a *specific* NumPy version that is newer than what `oldest-supported-numpy` provides, you must explicitly pin `numpy==X.Y.Z` in your `requirements.txt` or `pyproject.toml`.","message":"The *specific* NumPy version installed by `oldest-supported-numpy` is dynamic. It depends on your Python interpreter version (`sys.version_info`) and the platform/architecture you are running on (e.g., Linux, macOS, Windows, ARM, x86-64). It prioritizes the oldest *available wheel* for your specific environment, not necessarily the absolute oldest NumPy release.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For highly reproducible builds where the NumPy version must be identical across all environments, explicitly pin `numpy==X.Y.Z` in your dependency list. Use `oldest-supported-numpy` primarily when you need to ensure basic compatibility across a range of older Python versions without manually finding the minimal NumPy for each.","message":"Using `oldest-supported-numpy` can lead to non-deterministic NumPy versions across different environments if those environments use varying Python versions. For example, Python 3.8 might get NumPy 1.20, while Python 3.9 might get NumPy 1.22.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'2023.12.21':54 'cadenc':58 'chang':70 'compat':18 'current':51 'depend':78 'dependency-manag':77 'dynam':14 'ecosystem':85 'ensur':29 'gain':35 'given':23 'interpret':25 'irregular':60 'manag':79 'meta':11,75 'meta-packag':10,74 'new':64 'numpi':3,7,19,38,65,73 'oldest':1,5,17 'oldest-supported-numpi':4 'packag':12,76 'pin':82 'platform':27,33,68 'provid':15,49 'python':24 'recent':43 'releas':57 'scipi':84 'scipy-ecosystem':83 'specif':46 'support':2,6,36,69 'typic':61 'updat':62 'version':20,44,47,52,66,81 'version-pin':80 'warrant':71 'wheel':39","created_at":"2026-04-09T03:55:00.622949+00:00","updated_at":"2026-04-16T17:31:51.732030+00:00","problems":[{"fix":"Ensure `pip` or your package manager is correctly configured to install build dependencies. In some cases, for specific environments (e.g., custom Linux distributions or build systems), replacing the `oldest-supported-numpy` requirement with a specific `numpy` version constraint (e.g., `numpy >= 1.19.3`) in your project's `pyproject.toml` or `requirements.txt` might be necessary.","cause":"A project's build system (e.g., via `pyproject.toml`) declares `oldest-supported-numpy` as a dependency, but the build environment or package manager fails to correctly install this meta-package.","error":"ERROR Missing dependencies: oldest-supported-numpy"},{"fix":"Upgrade your Python interpreter to a supported version (Python 3.5 or newer). If the problematic package only requires `numpy` and not specifically `oldest-supported-numpy`, consider removing `oldest-supported-numpy` from your project's dependencies and just specify a compatible `numpy` version directly.","cause":"This error typically occurs when attempting to install `oldest-supported-numpy` or a package that depends on it using a Python version that is not supported by `oldest-supported-numpy` (e.g., Python 2.7, as `oldest-supported-numpy` requires Python >= 3.5).","error":"ERROR: No matching distribution found for oldest-supported-numpy"},{"fix":"Create a new virtual environment and reinstall all dependent packages, allowing `pip` to resolve and install compatible versions of NumPy and its dependents. For packages installed from source, ensure consistent NumPy versions are used both during compilation (often through build constraints) and at runtime.","cause":"This indicates an ABI (Application Binary Interface) incompatibility. It means a Python package (like SciPy, scikit-learn, or spaCy) was compiled against one NumPy version (often an older one specified by `oldest-supported-numpy`), but at runtime, a different, incompatible NumPy version is present or was installed, leading to binary mismatch.","error":"RuntimeError: module compiled against API version 0x... but this version of numpy is 0x..."},{"fix":"Ensure NumPy is correctly installed and its path is accessible. If using a package that relies on `oldest-supported-numpy` for its build, try reinstalling the dependent package in a clean virtual environment to force a fresh resolution and installation of NumPy. Sometimes, explicitly running `pip install numpy` before installing the problematic package can help.","cause":"Although `oldest-supported-numpy` is intended to manage NumPy dependencies, this `ModuleNotFoundError` suggests that NumPy itself is not correctly installed or accessible in the environment where a package attempts to import it, possibly due to build isolation issues or an incomplete installation process.","error":"ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/scipy/oldest-supported-numpy","docs":null,"changelog":null,"pypi":"https://pypi.org/project/oldest-supported-numpy/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-09","next_check":"2026-07-08","install_tag":null}}