Quantcast
Viewing all articles
Browse latest Browse all 14097

Why vs code is giving 'ModuleNotFoundError: No module named 'torch'' when I already Installed the module

So I was trying to install the pytorch module and like any sane person I did the following:

python -m venv env

source env/bin/activate

Then I installed pytorch as given in the official documentation.

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Now If run python in the terminal and 'import torch' it runs perfecty, also if I run any file importing pytorch with terminal, or inside vs code terminal(Run Python File) it works fine.But when I run using code runner(Run Code) it throughs MooduleNotFoundError.

I have selected the correct Interpretor Path(/env/bin/python).

What is the problem here??


Viewing all articles
Browse latest Browse all 14097

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>