×

Search anything:

Install torchvision without upgrading torch

In this article, we have explored how to pip install torchvision without upgrading torch.

In short, the solution is to use the following command:

pip install torchvision==0.8.1 --no-deps

Issue

The issue is on installing torchvision, the version of torch is automatically upgraded or downgraded. The command used is:

pip install torchvision

OR, with a specific version of torchvision:

pip install torchvision==0.8.1

This will trigger "pip install torch" as torch is a dependency of torchvision. This can be an issue if your torch environment is a custom torch build. It can be replaced by the pip installed torch.

Solution

The solution is to install torchvision with no-deps option so that no other dependencies are installed automatically.

pip install torchvision==0.8.1 --no-deps

Another option is to build torchvision from source. Get the source code of torchvision using the following command:

git clone https://github.com/pytorch/vision

With this article at OpenGenus, you must have the complete idea of how to pip install torchvision without upgrading torch.

Install torchvision without upgrading torch
Share this