Including channels in a pip_requirements.txt file

In a pip_requirements.txt file, is there a way to specify the channel to use for some specific packages to avoid having to call pip twice as below:

pip install -r env_requirements.txt
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

To my understanding, each line of the file is literally just a listing of command-line arguments for an invocation of Pip; so you should be able to just write e.g. torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 on a line of the file.

1 Like