A server with no route to the package index still needs its packages. Collect them somewhere with a connection, carry the folder over, and install from it.
On the machine that is online:
python3 -m pip download -r requirements.txt -d ./wheels
This saves each package and its dependencies as files and installs nothing. Copy wheels and the requirements file to the other machine, then run:
python3 -m pip install --no-index --find-links=./wheels -r requirements.txt
--no-index tells pip to stay away from PyPI, and --find-links points it at your folder. If something is missing you get an error right away, which I prefer to a silent attempt to reach the network.
The part that trips people up is platforms. By default pip downloads files that fit the machine you run it on. A wheel fetched on a Mac won’t install on a Linux server, and a different Python version can be a problem too. The easiest fix is to download on a machine that matches the target. pip also has --platform and --python-version for this, together with --only-binary=:all:.
Further reading: pip download