Getting same error for numpy 2.0 as of March 18th 2025.

Current solution is to install the latest version of numpy 1 (1.26.4) instead:

Copypip install "numpy<2"

You will likely have to restart the kernel afterwards.

Answer from Talha Tayyab on Stack Overflow
🌐
Reddit
reddit.com › r/pytorch › version compatibility guide
r/pytorch on Reddit: Version compatibility guide
June 18, 2024 -

Is there somewhere a searchable version compatibility database? As in all python projects reconciling versions is a pretty annoying problem, I meet it again and again.

Currently I try to use pytorch2.3.1 with cuda 11.8 , python 3.11.2 . It seems like I cannot get rid of a warning ( UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:84 ).

Id guess its caused by an incorrect numpy version. Is there a place to look up what combination of torch-cuda-python-numpy is ok and which is not?

🌐
GitHub
github.com › pytorch › pytorch › issues › 107302
NumPy 2.0 Support · Issue #107302 · pytorch/pytorch
August 16, 2023 - In terms of PyTorch future release, it means that, as of today, the expected support matrix looks like: PyTorch <=2.1 and nightly until EOY 2023 can live alongside any version of NumPy but the .numpy() and .from_numpy() functions will ONLY work ...
Author   albanD
🌐
Reddit
reddit.com › r/learnpython › torch is being built with the wrong version of numpy (with pip)
r/learnpython on Reddit: Torch is being built with the wrong version of NumPy (with pip)
April 13, 2025 -

Hello, I need help with the problem I'm trying to solve for a few days now. I have to run a project which uses a bunch of packages, including NumPy 1.22 and PyTorch 1.13. I'm using Windows 10 and Python 3.10.11 with pip 23.0.1. When I install the appropriate versions of the packages and try to run the project, I'm getting error: Failed to initialize NumPy: module compiled against API version 0x10 but this version of numpy is 0xf (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:77.). AFAIK 0xf is 1.22 (the version I have installed) and 0x10 is 1.23/1.24.

What I tried:

  1. Reinstalling Python including removing everything Python-related (like files in %APPDATA%) to be sure that no versions of NumPy and PyTorch exist in my system (except for packages bundled in some software that I don't want to uninstall).

  2. Checking the Path variable to be sure that the correct version of Python and pip is used.

  3. Using venv to have a clear environment.

But still somehow torch seems to be installed with NumPy 1.23/1.24 despite the fact that I have no such version of that package in my system (I searched my entire disk). When I import NumPy and print the version and the path, it correctly shows version 1.22 and the path to the package in venv I created.

I also can't update to the newest version of NumPy (or to 1.23/1.24) because then I get incompatibility with SciPy version. I also can't upgrade the project's requirements, the code is from a paper I'm not the author of so it would be cumbersome.

🌐
GitHub
github.com › pytorch › pytorch › issues › 135013
NumPy 2.1.0 Compatibility Issue with PyTorch 2.4.0: Importing PyTorch with NumPy 2.1.0 Causes _ARRAY_API not found Error · Issue #135013 · pytorch/pytorch
September 3, 2024 - The error indicates that a module compiled using NumPy 1.x cannot be run with NumPy 2.1.0 due to potential crashes. It suggests that modules must be compiled with NumPy 2.0 or newer to support both versions...
Author   sascharo
🌐
NumPy
numpy.org › doc › stable › user › basics.interoperability.html
Interoperability with NumPy — NumPy v2.4 Manual
PyTorch implements __array_wrap__ to be able to get tensors back from NumPy functions, and we can modify it directly to control which type of objects are returned from these functions. CuPy is a NumPy/SciPy-compatible array library for GPU-accelerated computing with Python.
🌐
GitHub
github.com › qiskit-community › qiskit-machine-learning › issues › 812
Pinned `torch==2.2.2` breaks CI due to `numpy>=2.0` · Issue #812 · qiskit-community/qiskit-machine-learning
July 2, 2024 - Release the torch==2.2.2 constraint to install the latest Numpy 2.0-compatible version (>=2.3.1), keeping in mind the UTF-8 issue in PyTorch 2.3.0, #797 and pytorch/pytorch#124897, that was affecting the CI tests on Windows platform.
Author   edoaltamura
🌐
Stack Overflow
stackoverflow.com › questions › 79532275 › why-does-torch-import-complain-about-numpy-version
python - Why does torch import complain about numpy version - Stack Overflow
It is simply that the version of pytorch you are using was built using numpy 1.x, and you have numpy 2.x installed, these are not compatible.
Find elsewhere
🌐
NumPy
numpy.org › doc › 2.2 › user › basics.interoperability.html
Interoperability with NumPy — NumPy v2.2 Manual
PyTorch implements __array_wrap__ to be able to get tensors back from NumPy functions, and we can modify it directly to control which type of objects are returned from these functions. CuPy is a NumPy/SciPy-compatible array library for GPU-accelerated computing with Python.
🌐
NVIDIA Developer Forums
forums.developer.nvidia.com › robotics & edge computing › jetson systems › jetson orin nano
Compatibility Issue: PyTorch Requires NumPy 1.x, but PySpin Needs NumPy 2.x on JetPack 6.0 (Jetson Orin Nano) - Jetson Orin Nano - NVIDIA Developer Forums
September 18, 2025 - Hi all, I’m using a Jetson Orin Nano running JetPack 6.0. I’ve installed PyTorch from the official wheel, but it requires NumPy 1.x to function properly. I’m also using a FLIR camera with the system, and the required P…
🌐
GitHub
github.com › facebookresearch › pytorch3d › issues › 1110
Numpy Version? · Issue #1110 · facebookresearch/pytorch3d
March 9, 2022 - Does pytorch3d only support numpy and numpy-base with version >= 1.21? I have a package compatible with numpy <= 1.19.5 only what can I do?
Author   Hiusam
🌐
GitHub
github.com › pytorch › pytorch › issues › 131668
Release 2.4 windows wheels are not compatible with numpy 2.0 · Issue #131668 · pytorch/pytorch
July 24, 2024 - When numpy not preinstalled on ... 2.0.1 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0....
Author   atalman
🌐
PyPI
pypi.org › project › torch
torch · PyPI
[!NOTE] If you installed nodejs with a different package manager (e.g., conda) then npm will probably install a version of katex that is not compatible with your version of nodejs and doc builds will fail. A combination of versions that is known to work is node@6.13.1 and katex@0.13.18. To install the latter with npm you can run npm install -g katex@0.13.18 · [!NOTE] If you see a numpy incompatibility error, run: ... When you make changes to the dependencies run by CI, edit the .ci/docker/requirements-docs.txt file. To compile a PDF of all PyTorch documentation, ensure you have texlive and LaTeX installed.
      » pip install torch
    
Published   Mar 23, 2026
Version   2.11.0
🌐
GitHub
github.com › pytorch › pytorch › issues › 147122
PyTorch build with numpy version incompatibility · Issue #147122 · pytorch/pytorch
February 13, 2025 - I'm building the latest PyTorch ... 2.2.2 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0....
Author   H-Huang
🌐
PyTorch Foundation
pytorch.org
PyTorch Foundation
Stable represents the most currently tested and supported version of PyTorch. This should be suitable for many users. Preview is available if you want the latest, not fully tested and supported, builds that are generated nightly. Please ensure that you have met the prerequisites below (e.g., numpy), depending on your package manager.
🌐
NumPy
numpy.org › doc › 2.1 › user › basics.interoperability.html
Interoperability with NumPy — NumPy v2.1 Manual
PyTorch implements __array_wrap__ to be able to get tensors back from NumPy functions, and we can modify it directly to control which type of objects are returned from these functions. CuPy is a NumPy/SciPy-compatible array library for GPU-accelerated computing with Python.
🌐
GitHub
github.com › pytorch › pytorch › issues › 148908
Numpy v1 v2 compatibility · Issue #148908 · pytorch/pytorch
March 10, 2025 - module: numpyRelated to numpy support, and also numpy compatibility of our operatorsRelated to numpy support, and also numpy compatibility of our operators
Author   clee2000
🌐
Towards Data Science
towardsdatascience.com › home › latest › hello pytorch – installation & numpy comparison
Hello PyTorch - Installation & Numpy Comparison | Towards Data Science
January 24, 2025 - As you can see, the folks at PyTorch.org will generate a terminal command which you have to execute. The GPU version has around 750MB, so it might take a while to download and install. Once done, you can open up a Jupyter Notebook environment. Imports-wise the only two libraries that will be needed are Numpy ...
🌐
PyTorch Forums
discuss.pytorch.org › t › building-torchvision-with-numpy-support › 206439
Building TorchVision with numpy support - PyTorch Forums
July 17, 2024 - Hi, I get the following error from my Python code: File "/disk1/mahmood/vision/torchvision/transforms/functional.py", line 168, in to_tensor img = torch.from_numpy(np.array(pic, mode_to_nptype.get(pic.mode, np.uint8), copy=True)) RuntimeError: PyTorch was compiled without NumPy support That ...