Skip to content

Instantly share code, notes, and snippets.

@alecGraves
Last active April 9, 2024 06:09
Show Gist options
  • Save alecGraves/c0f1223d653b6488fde748dcac42d232 to your computer and use it in GitHub Desktop.
Save alecGraves/c0f1223d653b6488fde748dcac42d232 to your computer and use it in GitHub Desktop.
How to Install Python, Keras and Tensorflow (with GPU) on Windows or Ubuntu

What?

Python, Keras, and Tensorflow have made neural networks easy and accessable to everyone. I personally have had a lot of trouble finding a nice and easy guide detailing how to set up all three on a system. This guide contains simple, step-by-step instructions on how to install these three things.

1. Anaconda

Anaconda is a python package manager that does a lot of stuff for you. It contains many packages including pip, numpy, scipy, etc.

Step one is to install it. Do that by going here, downloading the package for your OS, and installing it.

2. Python 3.5.2

This step may not be necessary in the future, but for now, it is required.

open powershell or terminal and run the following command:

conda install python=3.5.2

3. GPU (if you want to use GPU)

Note, for your system to actually use the GPU, it nust have a Compute Capibility >= to 3.0

3.1: Install CUDA 8.0

Go to this website and download CUDA for your OS.

Windows:

  • double-click the executable and follow setup instructions

Linux:

  • follow the instructions here

3.2: Install CUDNN

You will need to make a NVIDIA developer account to get these files.

Go here, login, and download CUDNN for your OS

Windows:

  • Extract the folder
  • Copy the files in the 3 folders to the same folders in C:\Program_Files\NVIDIA CUDA Toolkit (This requires admin permissions)

Ubuntu:

  • Extract the folder
  • run sudo nautilus to open the file manager as root
  • copy the files from the 2 extracted folers to the same-named folders in /usr/local/CUDA

4. Tensorflow and Keras

This is the last step in system setup. Just open powershell or terminal and run one of the following commands.

With GPU:

pip install tensorflow-gpu keras

Without GPU:

pip install tensorflow keras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment