Installing TensorFlow and Keras on Windows without a Live Internet Connection

I’ve taught workshops on TensorFlow and Keras several times. I always like to start by going through the installation process because it’s not trivial and the process reveals several ideas that are very important.

I’ve got a workshop coming up with 100 people. I know from past experience that 100 people trying to download and then install TF/Keras at the same time over a wireless network connection just won’t work. The files are big and the installation process actively goes out to the Internet to grab dependencies.

So, I set out to learn how to install TF/Keras on Windows, without being connected to the Internet. How difficult could it be?

Approximately 12 hours later I knew exactly how difficult it could be. Very.

Briefly, I downloaded the Anaconda3 self-extracting executable. Then I discovered and downloaded 8 TF/Keras dependencies as WHL files. Then I did a preliminary installation to get access to three dependencies that didn’t have WHL files. All these files (and three pre-built directories) can be placed on a USB drive, and then it’s possible to install TF/Keras without an active Internet connection.


These are the files and directories needed to install TF/Keras on Windows without an active Internet connection

1. Double-click on the Anaconda3 5.2.0 self-extracting installer. This will install Python 3.6.5 and approximately 500 Python packages. It will also create a directory at

C:\Users\(user)\AppData\Local\Continuum\anaconda3\Lib\site-packages

2. Use “pip install” to install these 8 WHL packages that were downloaded earlier:

1. protobuf             3.6.1
2. grpcio               1.10.0
3. Markdown             3.0.1
4. absl_py              0.6.0
5. msgpack              0.5.6
6. astor                0.7.1
7. Keras_Applications   1.0.6
8. Keras_Preprocessing  1.0.5

3. Copy these five pre-built package directories and one file into the site-packages directory:

gast
gast-0.2.0.dist-info

tensorboard
tensorboard-1.11.0.dist-info

termcolor-1.1.0.dist-info
termcolor.py

4. At last, install TensorFlow 1.11.0 using pip install.

5. TF now comes with a version of Keras but you can install Keras 2.2.4 using pip install if you wish.

6. Even after all this, there’ll be a couple of glitches. For me, I had to use pip install to upgrade my h5py package to version 2.8.0 to avoid an annoying warning message.



First part — installing WHL based packages (after installing Anaconda)



Last part of install (after copying pre-built directories for gast, tensorboard, termcolor)

I think the moral of the story is that working with machine learning libraries is still a relatively new activity. Compared to modern applications development using Java or C#, even simple things like ML library installation and configuration are quite primitive.

This entry was posted in Keras, Machine Learning. Bookmark the permalink.