Skip to content

Instantly share code, notes, and snippets.

@nanusdad
Created June 27, 2025 05:44
Show Gist options
  • Save nanusdad/70d0ec64620a9cf91ec83707d07dc4cd to your computer and use it in GitHub Desktop.
Save nanusdad/70d0ec64620a9cf91ec83707d07dc4cd to your computer and use it in GitHub Desktop.
pip install when server does not have internet access

pip install on server with no internet access

This is a three step process. First, download the required packages on a machine with internet access. Then, copy files over to the server with no internet access using scp or through a bastion host. Finally, run the pip install command to use local files.

Download required files

pip download -r ./requirements.txt -d "dependencies"

This will download all the required packages to a local folder called dependencies

Compress the folder and copy to target

# To tar and compress
tar cfvz dependencies.tar.gz dependencies
# or
zip dependencies

# To copy
scp dependencies.tar.gz user@target:/tmp

On target server

# Untar / unzip files
tar xfvz dependencies.tar.gz
# Install using pip
pip install --no-index --find-links=/path/to/downloaded_packages -r requirements.txt

Explanation:

--no-index: Tells pip not to look at PyPI.

--find-links: Points to the local folder with the downloaded packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment