Random Walk

Hello, there!

Contact me

Email id-rahulr@iitk.ac.in show

Install Python modules to machine without internet

26 Dec 2020 » python

Often times, a python application is deployed on a machine with internet connectivity. In such cases, settingup the environment in respect of the dependecies would be fairly easy, as the packages or modules are installed using the regular pip or conda commands. The problem comes when the machine to be deployed is not internet facing. Following steps are to be taken in such scenarios (using pip)

Step 1. Download required packages/modules

First you will have to download the modules using an internet facing machine and locally store them in a repository. Use the following command to download the requisite dependecies

pip download -d <download-folder> <package-name>

Step 2. Generate a requirements.txt file using pip

You can create a requirements.txt file using the following command

pip freeze > requirements.txt

Step 3. Deploy the app on non-internet facing machine

Move the Folder in which the dependencies are downloaded along with the requirements.txt file

Step 4. Install dependecies locally using the following command

Following commands will install the dependecies which are downloaded earlier on the development PC.

pip install --no-index -f <packages-folder> -r requirements.txt