How to download repository Python (pip) for an offline station

Viewed 1848

Today I have a problem to develop in my company on a dev-station outside the network (for security).

I have to download the packages one by one. Because the web station does not have python (I'm not an admin). So I want to download (on my home) a repository on a hard drive and connect it to my development station (after scan virus of course :) ).

Can you help me?

Do you known some commands to do that on linux OS?

Best regards. Thanks x 10000 for your help.

2 Answers

Refer to this link on installing python and pip as user (without root permission). Then follow the steps below to use pip to get the repo files.

The pip command itself has a download option that you can use to download the package. It also downloads the dependent (requirements) packages.

pip download --no-cache-dir package_names

Here package_names are required packages separated by space. Either you can run in single command or run multiple command for multiple packages according to your need. For example:

$ mkdir repo && cd repo
$ pip download openpyxl psutil
Collecting openpyxl
  Downloading openpyxl-3.0.4-py2.py3-none-any.whl (241 kB)
     |████████████████████████████████| 241 kB 1.6 MB/s 
  Saved ./openpyxl-3.0.4-py2.py3-none-any.whl
Collecting psutil
  Downloading psutil-5.7.2.tar.gz (460 kB)
     |████████████████████████████████| 460 kB 5.1 MB/s 
  Saved ./psutil-5.7.2.tar.gz
Collecting jdcal
  Downloading jdcal-1.4.1-py2.py3-none-any.whl (9.5 kB)
  Saved ./jdcal-1.4.1-py2.py3-none-any.whl
Collecting et-xmlfile
  Downloading et_xmlfile-1.0.1.tar.gz (8.4 kB)
  Saved ./et_xmlfile-1.0.1.tar.gz
Successfully downloaded openpyxl psutil jdcal et-xmlfile

Then on the developer machine just install using pip install

$ cd reop
$ pip install *

Note: if you have requirements.txt, you could download as

pip download -r requirements.txt
Related