[Solved] No module named "Torch"

Python Mohit Mozumder

Problem:

I successfully installed pytorch via conda & pip in my jupyter notebook. But when I try to execute a script from the console, I get the error message:

No module named "torch"

How can i solve this?


Solution:

Create a Conda environment using:

conda create -n env_pytorch python=3.6

Activate the environment using:

conda activate env_pytorch

Now install PyTorch using pip:

pip install torchvision 

Now go to Python shell and import using the command:

import torch
import torchvision

Thank you for reading the article. If you face any problem like this feel free to contact with us.