sahand1372
sahand1372

Reputation: 45

Install python packages offline on server

I want to install some packages on the server which does not access to internet. so I have to take packages and send them to the server. But I do not know how can I install them.

Upvotes: 0

Views: 21829

Answers (4)

Michał Machnicki
Michał Machnicki

Reputation: 2877

Download all the packages you need and send them to the server where you need to install them. It doesn't matter if they have *whl or *tar.gz extension. Then install them one by one using pip:

pip install path/to/package

or:

python -m pip install path/to/package

The second option is useful if you have multiple interpreters on the server (e.g. python2 and python3 or multiple versions of either of them). In such case replace python with the one you want to use, e.g:

python3 -m pip install path/to/package

If you have a lot of packages, you can list them in a requirement file as you would normally do when you have access to the internet. Then instead of putting the names of the packages into the file, put the paths to the packages (one path per line). When you have the file, install all packages by typing:

python -m pip install -r requirements.txt

In the requirements file you can also mix between different types of the packages (*whl and *tar.gz). The only thing to take care about is to download the correct versions of the packages you need for the platform you have (64bit packages for 64bit platform etc.).

You can find more information regarding pip install in its documentation.

Upvotes: 4

BlueSheepToken
BlueSheepToken

Reputation: 6099

You can either download the packages from the website and run python setup.py install. Or you can run a pip install on a local dir, such as :

pip install path/to/tar/ball

https://pip.pypa.io/en/stable/reference/pip_install/#usage

Upvotes: 1

specbug
specbug

Reputation: 562

Download the wheel packages from https://www.lfd.uci.edu/~gohlke/pythonlibs/ . You may install the .whl packages by pip install (package.whl) , refer installing wheels using pip for more.

Upvotes: -1

Manoj Vadehra
Manoj Vadehra

Reputation: 846

Download the package from website and extract the tar ball. run python setup.py install

Upvotes: -2

Related Questions