2

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.

marc_s
  • 675,133
  • 158
  • 1,253
  • 1,388
Carapate
  • 21
  • 1
  • Does this answer your question? [How to install packages offline?](https://stackoverflow.com/questions/11091623/how-to-install-packages-offline) – venky__ Aug 16 '20 at 10:24

2 Answers2

0

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
Padhu
  • 31
  • 5
0

As stated in https://pip.pypa.io/en/stable/reference/pip_download/

You can just use pip download, provide the directory with -d and then use pip install later

$ pip download -d /tmp/package SomePackage
Al rl
  • 314
  • 1
  • 9