pip's SOCKS support needs the optional SOCKS dependency available to the Python interpreter running pip. If that interpreter can reach the package index only through SOCKS, fetch the dependency on another connected machine first.

On the connected machine, prepare a small wheel directory:

python -m pip download --only-binary=:all: --dest wheelhouse PySocks

Transfer that directory to the target machine, then use its intended interpreter for the local installation:

python -m pip install --no-index --find-links wheelhouse PySocks

--no-index keeps this bootstrap step on the supplied files. It does not attempt to solve the original connectivity problem by making another index request.

Once the dependency is available, the SOCKS route can be selected for the actual package operation:

python -m pip install --proxy socks5h://proxy.example.net:1080 package_name

For permitted public package downloads without proxy authentication, replace the endpoint with a candidate from the SOCKS5 proxy list and select the intended package. The socks5h spelling requests destination-name resolution through the proxy; socks5 selects local destination resolution in this client path.

Keep the bootstrap installation and package operation on the same interpreter and environment. Installing PySocks into a different Python leaves the target pip's imports unchanged. The useful check is which python -m pip command runs the job, not whether some other terminal reports that PySocks is installed.

Artiglyn mynjee