This procedure has been tested on Fedora 29, on a HP laptop with this graphical card: NVIDIA Corporation GP107M GeForce GTX 1050 Mobile (rev a1)

The commands have to be run as the root user. This tutorial assumes the nvidia driver is already working.

Install pip

dnf install python3-pip

Install Cuda 10.0

Download the installer from the Nvidia website and run it. Make sure to install the Perl module Term::ReadLine::Gnu beforehand because the cuda installer relies on it.

cpan install Term::ReadLine::Gnu
wget https:////
TPMDIR=/root sh cuda_10.0.130_410.48_linux  --override

I specify the TMPDIR environment variable so the installer uses the /root partition for temporary files (as I don’t have enough space in my /tmp folder). The --override flag tells the cuda installer to not check the gcc version.

Install cudnn for cuda 10

tar -xvf cudnn-10.0-linux-x64-v7.4.2.24.tgz
cp include/cudnn.h /usr/local/cuda-10.0/include/cudnn.h
cp lib64/ /usr/local/cuda-10.0/lib64/
ln -s /usr/local/cuda-10.0/lib64/ /usr/local/cuda-10.0/lib64/
ln -s /usr/local/cuda-10.0/lib64/ /usr/local/cuda-10.0/lib64/

Update environmeent variables

So your compiler can find the installed libraries:

cat >> ~/.bashrc << EOF
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
export CUDA_HOME=/usr/local/cuda-10.0
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/cuda-10.0/samples/common/inc

Install GCC 7

Cuda 10.0 requires a GCC version <= 7. We install GCC 7 from Fedora 27.

cat >> ~/.bashrc << EOF
wget \ \ \

rpm -ivh --force --nodeps *.rpm

You can test the installation by running:

cd /usr/local/cuda/samples/1_Utilities/deviceQuery

You should see Result = PASS in the output

Install PyTorch

pip3 install torchvision

Install Tensorflow

We install the nightly version which supports cuda 10

pip3 install tf-nightly-gpu

You can test if Tensorflow works properly by importing it and running :

import tensorflow as tf
with tf.Session() as sess:
    devices = sess.list_devices()

The output must something like:

name: GeForce GTX 1050 major: 6 minor: 1 memoryClockRate(GHz): 1.493
pciBusID: 0000:01:00.0
totalMemory: 1.95GiB freeMemory: 1.57GiB
2019-02-23 17:08:53.794390: I tensorflow/core/common_runtime/gpu/] Adding visible gpu devices: 0
2019-02-23 17:08:53.803004: I tensorflow/stream_executor/platform/default/] Successfully opened CUDA library
2019-02-23 17:08:53.820094: I tensorflow/core/common_runtime/gpu/] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-02-23 17:08:53.820174: I tensorflow/core/common_runtime/gpu/]      0
2019-02-23 17:08:53.820196: I tensorflow/core/common_runtime/gpu/] 0:   N
2019-02-23 17:08:53.820612: I tensorflow/core/common_runtime/gpu/] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1387 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1050, pci bus id: 0000:01:00.0, compute capability: 6.1)