When we are installing pytorch using python pip, we may get IndexError: list index out of range error. In this tutorial, we will introduce how to fix it.
How to fix?
We can run command below to update pip, then install pytorch again.
Update pip
python -m pip install --upgrade pip
Then install pytorch
pip install torch
You may find this index out of range error is fixed. However, you may get ERROR: torch has an invalid wheel, .dist-info directory not found. You can read the solution below.
Fix ERROR: torch has an invalid wheel, .dist-info directory not found – PyTorch Tutorial