Numpy is not available error

Traceback (most recent call last):                                                           
File "C:\Users\averw\Desktop\repos\vocal-remover\inference.py", line 184, in <module>          
main()
File "C:\Users\averw\Desktop\repos\vocal-remover\inference.py", line 152, in main              y_spec, v_spec = sp.separate(X_spec)                                                           
File "C:\Users\averw\Desktop\repos\vocal-remover\inference.py", line 77, in separate
mask = self._separate(X_mag_pad, roi_size)
File "C:\Users\averw\Desktop\repos\vocal-remover\inference.py", line 42, in _separate          
X_batch = torch.from_numpy(X_batch).to(self.device)                                            
RuntimeError: Numpy is not available

why is this error happening in PyTorch? I have numpy 1.21.2 installed, and I have PyTorch Nightly with CUDA 11.3

I cannot reproduce the issue, as the installation automatically also installs numpy:

pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu113/torch_nightly.html
...
Installing collected packages: torch, numpy, torchvision
Successfully installed numpy-1.22.3 torch-1.12.0.dev20220311+cu113 torchvision-0.13.0.dev20220311+cu113

Manually uninstalling numpy reproduces the error:

python -c "import torch; import numpy as np; print(torch.from_numpy(np.random.randn(1)))"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'

but re-installing it fixes the issue again:

pip install numpy
Collecting numpy
  Using cached numpy-1.22.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
Installing collected packages: numpy
Successfully installed numpy-1.22.3

python -c "import torch; import numpy as np; print(torch.from_numpy(np.random.randn(1)))"
tensor([0.2141], dtype=torch.float64)

Okay, it seems to be because i am on Python 3.10. According to here, it’s only available through 3.9.

Yup, by using py -3.9 it works. Solved!