Can't import torch


(Shikhar Parikh) #1

I’m Running 64 Bit Windows With CUDA 9.2 support , with Conda as my preferred package manager.
Used ’ conda install pytorch -c pytorch’ and managed to install Pytorch 0.4.1 .
When i try to import torch , I get the “module not found error” , I can’t install Torchvision either
IMG_20180809_224122|666x500


#2

Could you try to create a new and clean conda environment and reinstall pytorch and torchvision there?
You will find more information on managing conda environments here.


(Shikhar Parikh) #3

I created a new Conda environment and installed Pytorch , I still can’t import torch or install Torchvision

15339895805591337528185|374x500


#4

Do you get any error messages?
Could you paste the commands and output as code with three backticks ```?
Your images don’t seem to work.


(Shikhar Parikh) #5

conda create --name pytorch

activate pytorch

conda install pytorch cuda92 -c pytorch

After Pytorch and all the necessary packages were downloaded and the transaction was succesfully executed,
i did the following:

ipython

import torch

<ipython-input-1-eb42ca6e4af3> in <module>()
----> 1 import torch
ModuleNotFoundError: No module named 'torch'

#6

Did you get any output after the conda install?
Could you try using python instead of ipython?

If you still get import errors, could you try to install the CPU version:

conda install pytorch-cpu -c pytorch 

(Shikhar Parikh) #7

using python instead of ipython worked
installed torchvision as well!!
Thank You!


(Lingvisa) #8

Hey, I am having the same issue. Yes, python works, but I prefer iPython terminal. Why can’t iPython find the torch module?


(Lingvisa) #9

Reinstalled fixed the problem. Thanks.