Reputation: 2975
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?
Upvotes: 4
Views: 6823
Reputation: 120419
On you local machine (adapt the instructions if you are on Windows)
requirements.txt
file(venv) [...]$ mkdir pkgs
(venv) [...]$ cd pkgs
(venv) [...]$ pip freeze > requirements.txt
(venv) [...]$ pip download -r requirements.txt
Download pip
archive from here
Copy pkgs
folder to the remote machine
On the remote machine:
pip
from archive(venv) [...]$ cd pkgs
# --- unarchive pip.tar.gz ---
(venv) [...]$ python setup.py install
(venv) [...]$ pip install --no-index --find-links . -r requirements.txt
Upvotes: 12