2

Along the lines of pip requirements.txt with alternative index (see also this) I have to install a version of a package that requires passing an --extra-index-url and I want to do this inside requirements.txt. This works if I run pip install -r requirements.txt.

The kicker is that I want my package to be pip installable. I have the requirements.txt of my package inside a directory with the other necessary files like setup.py and the pyproject.toml and whilst I can run the previous command I can't do pip install . to install my package locally from the current directory.

How can I ship a pip installable package with a requirements.txt file that contains an extra index URL?

(If pip doesn't allow this as I suspect, please suggest workarounds!)

Right now I have this in the requirements file (just an excerpt):

seaborn==0.11.2
--extra-index-url https://download.pytorch.org/whl/cu113 
torch==1.10.2+cu113 
pandas==1.1.5
numpy==1.17.4

My specific use case is with PyTorch, which I need to install with the correct CUDA version, so the command to install the relevant packages from PyTorch Start Locally is:

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
Anil
  • 1,097
  • 7
  • 20
  • Docs for `requirements.txt`: https://pip.pypa.io/en/stable/reference/requirements-file-format/#global-options – phd Apr 06 '22 at 14:44
  • `pytorch` in `requirements.txt`: https://stackoverflow.com/search?q=%5Bpip%5D+%5Bpytorch%5D+requirements.txt – phd Apr 06 '22 at 14:45

0 Answers0