This post is part of the #shortposts series where I publish my learnings in short ;)
Learning is a part and parcel of my journey. I started revisting Linear Algebra to explore the underpinnings of Artificial Intelligence and Quantum Computing. Linear Algebra is a good to have for AI and Quantum.
Recently, I picked PyTorch along with NumPy, SciPy, MatplotLib, and other Python libraries. Jupyter notebook is my go-to tool to learn AI, Data Science and other Python related topics.
Installing PyTorch
As a typical learner, I started with the below command to install PyTorch
in Jupyter.
!pip install torch
The error
In the next cell, when I run
import torch
torch.__version__
I see an error
ModuleNotFoundError: No module named 'torch'
The fix
After some research, I found that this is a common error and I was asked to run the pip
and python
commands to check the versions and upgrade if required etc., but nothing worked. Until I bumped into a magic command
%pip install torch
You may have to restart your kernel after running this command
Now, when I re-run the PyTorch
command
Top comments (0)