Skip to content

Instantly share code, notes, and snippets.

@vrillusions
Created May 1, 2018 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrillusions/150208d08f34e281b958a15793b2a46e to your computer and use it in GitHub Desktop.
Save vrillusions/150208d08f34e281b958a15793b2a46e to your computer and use it in GitHub Desktop.
How to install python packages completely from local files
# Original use case for this is on a jenkins server where jobs wipe their working
# directories and wipes the virtual environment with it. Was abandoned as we just
# got a regular caching server that it uses
# run these at initial setup and if requirements or pip version changes
# and yes old version of pip used `pip install --download` and newer versions
# use `pip download`.
mkdir -p "${HOME}/.cache/pip/localcache"
pip install --download "${HOME}/.cache/pip/localcache" -U pip setuptools
pip install --no-index --find-links="${HOME}/.cache/pip/localcache" -U pip setuptools
pip download -d "${HOME}/.cache/pip/localcache" -r requirements.txt
pip wheel -w "${HOME}/.cache/pip/localcache" -r requirements.txt
# actual commands to do at the start of each run
pip install --no-index --find-links="${HOME}/.cache/pip/localcache" -U pip setuptools
pip install --no-index --find-links="${HOME}/.cache/pip/localcache" -r requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment