Menu

Data Science Dev

Design, develop, deploy

Install Tensorflow 1.3 / Keras on Ubuntu 16.04 with NVIDIA 1080 Ti / Titan X

Note: These directions are subject to change, but worked for me on 8/12/2017 on a Intel 4-core CPU desktop.

1. Remove NVIDIA card from computer and plug Display/HDMI cable to the connector provided by motherboard.

2. Reboot computer and get into BIOS (delete/DEL key while restarting or other key)

3. If your motherboard has Secure Boot, turn it off/disable.  Save BIOS changes and reboot.

4. Install Ubuntu 16.04.x

5. After installation, open terminal.

6. sudo add-apt-repository ppa:graphics-drivers/ppa

7. sudo apt-get update

8. sudo apt-get upgrade

9. sudo apt-get install nvidia-375 (this may not work anymore on 10/26/2017 -- you maybe should use software & updates to use additional drivers and select the 378.xx driver after step 12 and restart, but I haven't confirmed)

10. Turn off computer

11. Plug in NVIDIA card and switch Display/HDMI to graphics card connector

12. Start up computer

13. Download NVIDIA CUDA Toolkit 8.0 (use .runfile only) and NVIDIA cuDNN library from NVIDIA's website.  You have to login for cuDNN libraries.  cuDNN 5.1 for TensorFlow version < 1.3.  cuDNN 6 for version = 1.3.

14. Follow instructions on NVIDIA website to install cuda toolkit (and patch if available) but do not upgrade NVIDIA driver (you will be asked during .runfile execution) or change default install directories

15. Follow instructions on NVIDIA website to install cuDNN (i put it in my home directory in a folder called cuda)

16. Open terminal.

17. Edit ~/.bashrc and add the following lines at the end of the file:
export LD_LIBRARY_PATH=~/cuda/lib64/:/usr/local/cuda-8.0/lib64/:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-8.0/bin:$PATH

18. Logout of Ubuntu and log back in

19. Open terminal.

20. sudo apt-get install libblas-dev liblapack-dev libjpeg-dev python-dev

21a. For python 2.7:
sudo apt-get install python-pip
sudo apt-get install idle
sudo pip install --upgrade pip
sudo pip install tensorflow
sudo pip install tensorflow-gpu (if you have a GPU)
sudo pip install theano
sudo pip install keras

22b. For python 3.5:
sudo apt-get install python3-pip
sudo apt-get install idle3
sudo pip3 install --upgrade pip
sudo pip3 install tensorflow
sudo pip3 install tensorflow-gpu (if you have a GPU)
sudo pip install theano
sudo pip install keras

23. Reboot

24. Try importing tensorflow, theano, or keras in python

25. You can change keras backend by editing the ~/.keras/keras.json file

26. You can change theano settings by editing the ~/.theanorc file (or programmatically)

27. You can force TensorFlow to use CPU by executing 'export CUDA_VISIBLE_DEVICES=' in terminal

Go Back

Comment

Blog Search

Comments

There are currently no blog comments.