To create an archive (from the official documentation: https://pip.pypa.io/en/latest/user_guide/#installation-bundles), perform the following:
- Create a temporary directory:
$ tempdir = $(mktemp -d /tmp/archive_dir)
- Create a wheel file:
$ pip wheel -r requirements.txt --wheel-dir = $tempdir
- Let the OS know where to place the archive file:
$ cwd = `pwd`
- Change to the temporary directory and create the archive file:
$ (cd "$tempdir"; tar -cjvf "$cwd/<archive>.tar.bz2" *)
To install from an archive, do the following:
- Create a temporary directory:
$ tempdir=$(mktemp -d /tmp/wheelhouse-XXXXX)
- Change to the temporary directory and unarchive the file:
$ (cd $tempdir; tar -xvf /path/to/<archive>.tar.bz2)
- Use pip to install the unarchived files:
$ pip install --force-reinstall --ignore-installed --upgrade --no-index --no-deps $tempdir/*