pip install with extra index url to requirements.txt

sharkyenergy

I have following install comand for a package:

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116

and would need to add this to my requirements.txt file. I have done it by adding this to the end of the file:

-i https://download.pytorch.org/whl/cu116
torch
torchvision 
torchaudio

after all the other requirements. I do not have the means to test it right now, and would need to know if I have done it correctly as I never did it before.

Is this the proper way of adding it to the requirements.txt file?

If yes, adding other packages after these, for example numpy, will it be affected by the url? do I have to sort of "clear" the url, or is it simply added to the list of urls it searches in?

Any help appreciated

Matthias

Found the solution, the command you used and the requirements.txt file were NOT in fact the same. It works with a requirements.txt like this

--extra-index-url https://download.pytorch.org/whl/cu116
torch
torchvision 
torchaudio

Turns out -i is not the same as --extra-index-url.

Docs: https://pip.pypa.io/en/stable/reference/requirements-file-format/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

--extra-index-url not work in python requirements.txt

fail to install requirements using "pip install -r requirements.txt"

pip install requirements.txt not working properly

Install a package and write to requirements.txt with pip

Install a package and write to requirements.txt with pip

python2; pip parse_requirements with --trusted-host and --extra-index-url

Format a requirements.txt file for pip where one or more packages have a different index-url

Unable to install using pip install requirements.txt

can't install. pip install -r requirements.txt

Does `pip install -U pip -r requirements.txt` upgrade pip before installing the requirements?

Per line index url in requirements.txt

Pip Install -r requirements.txt Without Failing

Equivalent of "pip install -U -r requirements.txt" for Cabal?

Is it safe to `pip install -r requirements.txt` after upgrading the interpreter?

How to install python module extras with pip requirements.txt file

Pip install a package in a way that it gets not listed in requirements.txt

install tar.gz with pip at requirements.txt

'RUN pip install -r requirements.txt' not working

Error when running pip install -r requirements.txt

pip install -r requirements.txt from puppet?

Install subset of packages listed in a requirements.txt file with PIP

AWS Python lambda: pip install requirements.txt with --no-deps

pip -U -r requirements.txt with a URL keeps reinstalling

unable to install requirements txt

Can I specify requirements.txt as EXTRA_PIP_PACKAGES in dask/helm-chart

convert pip requirements.txt to conda requirements

Can install packages one by one but cannot use pip install -r requirements.txt

How to specify pip --extra-index-url in environment.yml?

Passing PIP_EXTRA_INDEX_URL to docker build