Search code examples
pythonjupytertorch

ModuleNotFoundError: No module named 'torch' in ubuntu


When I want use torch in jupyter, I got this error

ModuleNotFoundError: No module named 'torch'

but I check that torch is installed already. following:

>>> python -c "import torch; print(torch.__version__)"
1.10.2+cu102

It is confirmed in Ubuntu CLI, but there is an error in jupyter only.

How can I fix it??

  • OS : Linux(Ubuntu 18.04)
  • Python : 3.6

Solution

  • Ubuntu CLI is not the same environment with jupyter. In Jupyter run this command%pip install <package name>