Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arobb/f0c81c1c91a8bb76f6158691c7ca9b12 to your computer and use it in GitHub Desktop.
Save arobb/f0c81c1c91a8bb76f6158691c7ca9b12 to your computer and use it in GitHub Desktop.
# Machine with internet access
virtualenv -p $(which python2.7) venv
source venv/bin/activate
mkdir pip-sources
pip download --no-binary ./pip-sources <package1>
pip download --no-binary ./pip-sources <package2>
pip install --no-index --find-links=./pip-sources <package1> <package2>
pip freeze > pip_requirements.txt
tar czf required-packages.tar.gz pip_requirements.txt ./pip-sources
# Target machine
tar xzf required-packages.tar.gz
pip install --no-index --find-links=./pip-sources -r ./pip_requirements.txt
# If you get errors, make sure all OS level pre-reqs are met:
sudo yum install python-devel
# If you see an order-of-operations problem with the install, but
# see the upstream package in pip_requirements.txt, execute the install
# command manually for the upstream package
pip install --no-index --find-links=./pip-sources <troublesome-package>
pip install --no-index --find-links=./pip-sources -r ./pip_requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment