How to cerate local cahe for pip to use in LAN without internet?

275 Views Asked by At

I am trying to get pip install working in a machine without internet connection. I tried using three proxies(devpi-server, proxypypi and pypicache) in a server within same LAN, but with internet connection.

pip --no-cache-dir --trusted-host <serverip> install -i http://<serverip>:3141/root/pypi/+simple/ Flask

Pip ends up not using the proxy and try to collect packages directly from piwheels.org and files.pythonhosted.org and throws error(since the machine doesn't have internet connection).

Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='www.piwheels.org', port=443): Max retries exceeded with url: /simple/flask/ (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75729ad0>: Failed to establish a new connection: [Errno 101] Network is unreachable',))

Any solutions? Thank you

1

There are 1 best solutions below

1
On

I usually use the --proxy flag as the example here

sudo pip install --proxy=https://[username:password@]proxyserver:port somepackage