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 OverflowGetting 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.
This will be easily solved by upgrading numpy.... When I face this error, that time numpy version 1.22 was installed.... I update version to 1.24.1 using this command
Copypip install numpy==1.24.1
Error Resolved
At least in Google Colab I was able to solve this issue by running (after installing xla):
!pip install -U numpy
Not completely sure it will help in any context
This is an issue with the version mismatch. Currently the pytorch version 1.12.1+cu113 is compatible with numpy version 1.21.6.
I don't know why this occurs. But keep checking the version in google colab and you can possibly make torch work locally.