Pytorch doesn't work with CUDA in PyCharm/IntelliJ
I have just downloaded PyTorch with CUDA via Anaconda and when I type into the Anaconda terminal:
import torch
if torch.cuda.is_available():
    print('it works')

then he outputs that;  that means that it worked and it works with PyTorch.
But when I go to my IDE (PyCharm and IntelliJ) and write the same code, it doesn't output anything.
Could someone please explain to me how I can somehow get this to work in the IDE?

It was driving me mad as well... What finally helped me was the first link that says to use PyCharm &quot;Terminal&quot; to run the pip install command (from the PyTorch website). That fixed all my problems. (I had installed pytorch 3 times by that time and tried different interpreters...)
https://www.datasciencelearner.com/how-to-install-pytorch-in-pycharm/
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio===0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
I hope this helps save someone hours of headache.   :)
