Is there a way to prioritise --index-url in pip install / download?
21:03 15 Mar 2026

I want to setup to use only CPU (saves e.g. space) and for a package it's described in e.g. How to install torch without nvidia? pip install p --index-url https://download.pytorch.org/whl/cpu. Now I have a project with list of dependencies and many of those are not available in 'https://download.pytorch.org/whl/cpu'. "ERROR: Could not find a version that satisfies the requirement" when running pip download --no-cache-dir /path/project --index-url https://download.pytorch.org/whl/cpu

But without --index-url it finds and starts to download large files supporting CUDA for which CPU-only versions are available in 'https://download.pytorch.org/whl/cpu'. Is there a way to prioritize --index-url but still download if not found there in one command? If not, what will you advise to simplify setup? I can only imagine many iterations of --no-deps. TIA

Python 3.10.12.

python pip