Search code examples
pythontensorflow

Installing Tensorflow 1.9 offline and manually


I am working on an offline Ubuntu 16.04 workstation using python 2.7. I cannot install the tensorflow library via pip,the internet or any other conventional methods.

On the remote system, I will be installing tensorflow 1.9 manually using downloaded .so files and .whl files by extracting them into a folder and adding that to the python 2.7 PATH.

I have installed all the dependencies like bazel etc.. manually prior to this.

How do I proceed with this offline installation process? What flow should I choose for proper installation of tensorflow and its dependencies?

Thanks


Solution

  • Tensorflow 1.9 is an outdated and deprecated version. Google has removed versions older than 1.15 from pypi. But you can definitely download and install the later versions with pip (with ease)

    You do not need internet to use pip. What pip does is download the package and process it locally. If you can download yourself and transfer the package then you can ask pip to just process and install the package for you.

    The following is for python 2.7 and tensorflow==2.0.0.. (Source Link)

    Download the package : ( for CPU only)

    wget https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl
    

    (For GPU Support)

    wget https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl
    

    Now copy the file to your PC (which does not have internet, via USB or whatever). Then install the package with pip or any other package manager (pip is preferred)

    # for CPU
    pip install tensorflow-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl
    # for GPU
    pip install tensorflow_gpu-2.0.0-cp27-cp27mu-manylinux2010_x86_64.whl
    

    I installed in a fresh conda environment. It worked fine with me and can run my code with this packages.

    For Older versions: Tensorflow has only the following versions on the PyPI repository

    1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.1.0rc0

    You can use pip to download the version. (I have downloaded 1.13.1, but change the version according to your requirement). Open a new folder and download using

    pip download tensorflow==1.13.1
    

    This will download a whole bunch of whl and tar.gz packages in the folder. Copy the entire folder to the new PC (without internet). Amongst them you will find tensorflow-1.13.1-cp27-cp27mu-manylinux1_x86_64.whl

    Install using pip

    pip install tensorflow-1.13.1-cp27-cp27mu-manylinux1_x86_64.whl
    

    UPDATE:

    While installing offline with pip install the dependcies first. In the above case install packages in the following order

    1. numpy, six, enum , h5py... etc
    2. Keras
    3. tensorboard
    4. tensorflow_estimator
    5. Finally tensorflow

    I did this for the CPU and it works fine. If you find any issue for the GPU please update. Mostly, this should solve the problem.