I am trying to import pytorch but I get an error that module does not exist. I installed via anaconda, and the folder "pytorch-0.1.12-py35_2cu80" exist in anaconda3/pkgs folder. why does it not recognize that it is there? should I rename this folder?
-Rik
/home/rik/anaconda3/bin/python /home/rik/PycharmProjects/self_driving_car/self_driving.py
Traceback (most recent call last):
File "/home/rik/PycharmProjects/self_driving_car/self_driving.py", line 18, in <module>
import pytorch
ImportError: No module named 'pytorch'
Process finished with exit code 1
2 Answers
The command to import pytorch is
import torch
not
import pytorch
It seems the module pytorch is not installed.
First make sure your using anaconda's python and not the system one.
To install pytorch via conda do
conda install pytorch torchvision -c soumith
or via pip
For python3
pip install
pip install torchvision
For python2
pip install
pip install torchvision
dont install the CUDA version if you dont have Nvidia GPU on your machine that supports.