Installing Tensorflow and CUDA on Manjaro Linux
Getting Tensorflow and CUDA to work together has always been pretty daunting to me. Each release of Tensorflow only works with a specific version of CUDA, cuDNN and Python. Here’s an example of the version combinations:
You can check this list over here:
If you don’t install the right version, you are presented with some lovely cryptic errors.
But I have good news! Installing Tensorflow and CUDA on Manjaro Linux is really easy thanks to the incredible Arch Linux’s repository!
Install the NVIDIA driver
(If have already installed the NVIDIA driver please skip this step)
This is where you need to do some research to install the right driver for your card. Read the install section of NVIDIA wiki page.
You are most likely going to install the nvidia
package unless your card is quite old (was made before 2011)
My card is a GeForce 840m, and I immediately saw for GeForce 600–900 I should install the nvidia
package. If you have a laptop with dual GPUs like I do. Then I recommend installing the bumblebee version which uses the intel GPU for pretty much everything, and the NVIDIA GPU when you really need it which help a lot with battery life. If you install the bumblebee version, there is one small caveat though which I point out in the end.
Installing Tensorflow, CUDA and cuDNN
This is where Arch Linux makes life easier! Just install them using pacman:
sudo pacman -S cuda cudnn python-tensorflow-opt-cuda
Giving it a try
It’s time to give it a try. If you installed bumblebee like me you need to use optirun
to run your python app otherwise it won’t use your GPU. I don’t know if it’s a bug or not, but you have to use optirun
, primusrun
doesn’t always work for me.
optirun jupyer notebook
In my opinion this simplicity makes any Arch Linux based distribution like Manjaro, a great platform to practice machine learning on.
Hope this helps!