Fixing Python Dependencies The Right Way
I'm just getting my first Python environment setup. All have gone well and it seems to be GPU enabled and all that good stuff.
However, I have one issue and no idea how to fix. After getting the correct install command for torch it informed of this issue:
Installing collected packages: torch
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchvision 0.8.2 requires torch==1.7.1, but you have torch 1.8.0+cu111 which is incompatible.
Successfully installed torch-1.8.0+cu111

As far as I can tell torchvision 0.8.2 is the latest version.
The environment seems happy at the moment as all these commands return expected things:
import torch
print(torch.__version__)
torch.cuda.get_device_name(0)

I've seen some people talking about &quot;patching requirements files&quot; or updating dependencies. But I'm not sure of the best way to tackle this.

You can lock the version of a package in a requirements file. This file has the appropriate values.
requirements.txt:
torch==1.7.1
torchvision==0.8.2

The packages are installed via pip like so:
pip install -r requirements.txt

You may have other dependencies for this project. In that case, you can generate a requirements.txt file with pip as well:
pip freeze &gt; requirements.txt

Check out the documentation on managing dependencies with pip
