Module not found 'torch'

Hi,

I’ve installed the latest version of pytorch (1.12.1) with cuda 11.3 using the following command in a new conda environment:
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

but when i try to import torch: “import torch” and running it i’m getting Module not found error: “torch”

I’m running on Windows 10, and i’ve tried using python=3.8 and python=3.9 and python=3.7 and still getting this error.

Also i made sure that i have cuda 11.3 installed using nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Mar_21_19:24:09_Pacific_Daylight_Time_2021
Cuda compilation tools, release 11.3, V11.3.58
Build cuda_11.3.r11.3/compiler.29745058_0

Any idea what could be the problem and how to resolve it?

Are you sure that you are activating the correct environment when importing torch? Just check if that is the issue.

yes, unfortunately i activated the correct environment. i try it from ipython on the console and it doesn’t work :frowning:

I even tried to install it using the pip installation from the official site and still the same problem

maybe it happens because i still have cuda 10.2 installed but in the environment variables in CUDA_PATH i have cuda 11.3


Capture2

The issue happens because your environment is not activated on the IPython kernel. You can add the environment to IPython terminal using this. Should do the work.

1 Like