Issue
I am trying to deploy a Python project to a machine with no internet. Because it has no internet, I cannot pip install any packages with a requirements.txt
file. I am wondering if it is possible to move my existing environment with all installed packages into another machine with all packages pre-installed.
I can also use attempt to use Docker for this installation. Would I be able to pre-install all the packages within a Docker container and then copy all the files onto another VM?
Solution
On you local machine (adapt the instructions if you are on Windows)
- Create your
requirements.txt
file
(venv) [...]$ mkdir pkgs
(venv) [...]$ cd pkgs
(venv) [...]$ pip freeze > requirements.txt
(venv) [...]$ pip download -r requirements.txt
Download
pip
archive from hereCopy
pkgs
folder to the remote machine
On the remote machine:
- Install
pip
from archive
(venv) [...]$ cd pkgs
# --- unarchive pip.tar.gz ---
(venv) [...]$ python setup.py install
- Install packages
(venv) [...]$ pip install --no-index --find-links . -r requirements.txt
Answered By - Corralien Answer Checked By - Robin (WPSolving Admin)