The Problem
Development and test clusters may be air-gapped so that client data or sensitive software under development is less likely to be leaked. This can cause problems when trying to install libraries, e.g. for Python-based software, especially if the cluster has an old version of a Linux OS installed.
The Solution
Setup Python's pip on the remote machine
- On an Internet-enabled machine, download the Wheel file for pip from https://pypi.python.org/pypi/pip, such as pip-9.0.1-py2.py3-none-any.whl.
- Copy the Wheel file (e.g. pip-9.0.1-py2.py3-none-any.whl) to the remote machine, e.g. using scp:
- scp pip-9.0.1-py2.py3-none-any.whl user@host:/path
- On the remote machine:
- python pip-9.0.1-py2.py3-none-any.whl/pip install --no-index pip-9.0.1-py2.py3-none-any.whl
- pip --version # this should display the version number if correctly installed
Download the required libraries
- On an Internet-enabled machine, download the library and its dependencies using the following. Note that the air-gapped machine contained Python 2.7.5, so I had to set the version in the pip download.
- mkdir downloads
- cd dowloads
- pip download
--python-version 2.7.5 --only-binary=:all: <library> - Copy the wheel files over to the remote host, e.g.
- scp *.whl user@host:/path
Install the libraries on the remote machine
- On the remote (air-gapped) machine, type:
- pip install --no-index --find-links="." <library>
Comments