0

I'm trying to solve this Error: ModuleNotFoundError: No module named 'torch' I did the installation of Pytorch using this command: conda install pytorch -c pytorch but when I import torch I got the message above.

Berriel
  • 12,659
  • 4
  • 43
  • 67
Eylul Mood
  • 15
  • 5
  • 3
    Does this answer your question? [ImportError: No module named 'Tkinter'](https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter) – crypthusiast0 Jun 09 '21 at 20:40
  • What is the output of `which python`? Or `pyhon3`, whatever you used to run python. – Berriel Jun 09 '21 at 21:25
  • This was wrongly closed. It **should still be a duplicate, but** I have not yet identified a proper canonical (I may have to create one). This question is about problems with installing third-party libraries and making sure they are installed *for the same copy of Python* that will run the code. Questions about Tkinter **should not** be used to close such a question as duplicates, because: a) Tkinter **is not** a third-party library; b) there are **two different common reasons** why Tkinter imports commonly fail, **neither of which** is the same problem as here. – Karl Knechtel Apr 28 '23 at 20:29

1 Answers1

0

You might be on another conda environment. try:

conda env list

and find the environment that you have installed pytorch on. then use:

conda activate NAME_OF_YOUR_ENV

to swtich to that environment and run your program there.

Soroush
  • 66
  • 1
  • 5