ModuleNotFoundError: No module named 'torch' on pycharm, python version 3.10

Viewed 48

it worked fine on cmd enter image description here

but when i tried it on pycharm it gave me an error: ModuleNotFoundError: No module named 'torch'

here is how i set it up on pycharm enter image description here

and the line i put on pycharm is:

import torch

print('gpu:', torch.cuda.is_available())

i wonder what is the problem

UPDATE:

Thanks to Xynias, now I changed to this: enter image description here

now the python version is 3.9 but it still has the same problem.

UPDATE: torch is installed. when i typed pip freeze the torch info are:

torch==1.12.1
torchaudio==0.12.1
torchvision==0.13.1

UPDATE:

so somehow when I add a new interpreter, torch isn't there: enter image description here

but I do have torch installed, why is this happening?

1 Answers

The Python you are using in CMD is different than the one you have selected in PyCharm. You either need to install PyTorch for the 3.10 conda version, or choose your interpreter as the one that appears in CMD.

Related