Install Python 3.x package without internet

2

It's not a code question, basically I could not find something similar to this.

I did a development in Python that I must run on a desktop computer, but the problem is that that computer does not have an internet connection and I need to have the Pandas package installed. Can you install Pandas without internet, taking it downloaded in a pendrive for example?

    
asked by Jorge Ponti 20.08.2017 в 03:23
source

1 answer

4

The most direct option is to download the .whl files from PyPI (Python Package Index) and install them with pip.

To do this, download whl from all Pandas dependencies, which I think they are:

And of course Pandas .

For each package you download the appropriate whl to the operating system (including if it is 32 or 64 bits) and the version of Python in which you will perform the installation. Later you use pip but pointing to the path of the whl file. First install the dependencies and finally Pandas, for example (for Windows, Python 3.6, 64 bits, with whl in the path E: / Downloads ):

  • py -3.6 -m pip install E:/Descargas/pytz-2017.2-py2.py3-none-any.whl
  • py -3.6 -m pip install E:/Descargas/python_dateutil-2.6.1-py2.py3-none-any.whl
  • py -3.6 -m pip install E:/Descargas/numpy-1.13.1-cp36-none-win_amd64.whl
  • py -3.6 -m pip install E:/Descargas/pandas-0.20.3-cp36-cp36m-win_amd64.whl

If it is for Windows and you have compilation problems you can use the precompiled binaries provided by Christoph Gohlke of the University of California instead of the whpi of PyPI:

link

The procedure is the same.

You will usually find the whl file for almost all the packages distributed in PyPi, however you can find some that are only available through the sources. These are found in compressed files of zip or tar.gz .

  • Installation with pip :

    • The file is decompressed using an appropriate program such as 7-Zip.
    • They are installed with pip using the argument -e followed by the directory path where the decompressed file is located:

      py -3.6 -m pip install -e package_directory
      
  • Using the file setup.py :

    • Unzip the file as before.
    • We open the terminal / console and place ourselves inside the directory where we have unzipped the file (where setup.py ) is located.
    • We install using the file setup.py found in that file:

      py -3.6 setup.py install
      

A somewhat less manual option is to build your own directory with everything you need using pip wheel , in the terminal in a PC with connection we make:

py -3.6 -m pip wheel --wheel-dir=D:/Descargas/wheelhouse pandas

This creates us a directory in D:/Descargas/ (change by the necessary route) with everything necessary to install Pandas (included dependencies). We can copy it like this or compress it first. We copy this on the computer without connection (as an example we use D:/Descargas/ as a route) and execute in the terminal:

py -3.6 -m pip install --no-index --find-links=D:/Descargas/wheelhouse pandas

Another option would be to use Anaconda which has Pandas among the libraries included in the installer among many others (around 100 as can be seen in the following list ).

  

Note : The terminal commands are only for example. In this case they are for the assumption of installing Windows packages on Python 3.6 using the Python Launcher. However, the idea is valid for other operating systems / versions of Python, just call pip correctly in each case.

    
answered by 20.08.2017 / 04:03
source