FreeImage is not set up correctly. Please ensure FreeImae is set up correctly

Hi, I followed the steps in:

Installation Guide - NVIDIA Docs to set up cudnn. Everything seems to be working fine but when I executed “make clean && make”, I got the above warning and no mnistCUDNN was created.

Somebody suggested setting the CUDA_PATH using: export CUDA_PATH=/usr/local.cuda-9.0

but it does not work. I also tried:

sudo ln -s /usr/local/cuda-9.0/ /usr/local/cuda-9.0

but same issue. Then, I tried:

sudo ln -s /usr/local/cuda-9.0/ /usr/local/cuda

Again, same issue.

I also executed the following line as somebody mentioned:

cat /usr/include/x86_64-linux-gnu/cudnn_v7.h | grep CUDNN_MAJOR -A 2

but I still get:

make clean && make
rm -rf *o
rm -rf mnistCUDNN
/usr/bin/ld: -lcublas cannot be found
collect2: error: ld returned 1 exit status

WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
:
:
:

Doing “sudo dpkg -i libcudnn7*.deb” and repeat Sec 2.4 Verifying cuDNN is installed resulted in the same error.

Executing: nvcc --version

leds to "Command ‘nvcc’ not found, but can be installed with:

sudo apt install nvidia-cuda-toolkit"

Not sure if I need to do that.

Could you please help to resolve the issue?

Also, I am concerned that I might set the wrong path and make the wrong symbolic links. Please let me know how to undo the above three lines of command that don’t work.

I am using Pop OS which somebody said is basically ubuntu. Not sure if this is true.

Thanks.

8 Likes

Assuming you are using cuda 9. In Ubuntu I put these exports in my .profile. If your .profile is empty then this is not the place to put it. You will have to figure that out yourself. This is in the cuda documentation. You will want to leave out the numbers at the beginning.

sudo nano $HOME/.profile
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

It might also be due to some 3rd party packages. In the cuda documentation it says to get these if you want to use the samples.

sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev

I also did a quick google search and saw on the third link something about “How To Install and Use FreeImage” it gave a library. So if the other things didn’t work try using the packages below.

sudo apt-get install libfreeimage3 libfreeimage-dev

If that doesn’t work use the Ubuntu that is supported with your cuda and cudnn version and do the things I put above. You probably don’t need to do the last one, though.

44 Likes

I ran into the same issue and this fixed it for me

46 Likes

Same here, this fixed it for me!

49 Likes

This still does not work for me. I have followed these instructions but continue to get the same error.

It seems that the above-mentioned two commands have not made sense to me. It still has the persistent error as follows.

Environment:
Ubuntu 18.04
Driver: 440.110 ppa
CUDA Toolkit 10.2
cuDNN 7.6.5

$ sudo cp -r /usr/src/cudnn_samples_v7/ $HOME
$ cd $HOME/cudnn_samples_v7/mnistCUDNN
$ make clean && make

/bin/sh: 1: cannot create test.c: Permission denied
/bin/sh: 1: cannot create test.c: Permission denied
g++: error: test.c: No such file or directory
g++: warning: ‘-x c’ after last input file has no effect
g++: fatal error: no input files
compilation terminated.

WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<

It is quite strange. After I re-install the Ubuntu System, it has generated the error.

1 Like

I reinstalled Ubuntu 18.04 system, Official Nvidia Driver 440.33, CUDA Toolkit 10.2 and cuDNN 7.6.5. It is quite strange I got Test passed! after I added the super user command “sudo -i”

$ sudo -i
$ cp -r /usr/src/cudnn_samples_v7/ $HOME
$ cd $HOME/cudnn_samples_v7/mnistCUDNN
$ make clean && make
$ ./mnistCUDNN

Test passed!

Ubunt ppa only allows 440.100 Driver. I had personally thought that it is the incompatibility between 440.100 Driver and CUDA Toollkit 10.2 that indicates the 440.33.01 driver with its detail listed as follows.

cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb

However, it still had the error with no inputting “sudo -i”. It does not make sense for me to install libfreeimage3 libfreeimage-dev in the new installed environment. What’s wrong with the error in the condition of no-inputting “sudo -i” command?

My test of mnistCUDNN is finally passed. It is quite strange that the terminal sometimes pops up the requirement of sudo. After adding sudo before the command, it fails. However, the terminal does not require the permission of sudo this time. So it is ok for me right now.

$ cp -r /usr/src/cudnn_samples_v7/ $HOME
$ cd $HOME/cudnn_samples_v7/mnistCUDNN
$ make clean && make
$ ./mnistCUDNN

By the way, It is not necessary for me to install libfreeimage3 libfreeimage-dev with any scenarios.

Test passed!

Cheers

1 Like

hello, running in same problem with cudnn_samples_v8. Chmod mnistCUDNN has no effect.
Ubuntu 18.04, Nvidia GTX650-TI-boost, Cuda Toolkit 11, 450.66 drivers

Thx in advance for any help

1 Like

This solved my issue as well. Thanks @KingDudman

3 Likes

So I followed the above suggestions and did the following -

sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
sudo apt-get install libfreeimage3 libfreeimage-dev

I even modified my paths:

export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

But this didn’t solve it for me.

I have initially installed cuDNN via Tar file installation (see steps 2.3.1 in Installation Guide :: NVIDIA Deep Learning cuDNN Documentation ) so after apt-get install and path modification, I did the Debian installation (see steps 2.3.2) which also includes steps to download samples.

This is helped solved the problem for me!

This fixed my issue also, Thanks!

sudo apt-get install libfreeimage3 libfreeimage-dev
3 Likes

you are a saver man

Hi, I came into the same problem, and I tried to install libfreeimage but it doesn’t fix the problem. Also tried restart, same.

I am installing cudnn on a freshly installed ubuntu 20.04 system, with nvidia driver 470.74 and cuda 10.1. ‘nvidia-smi’ and ‘nvcc --version’ both give correct results. When I run ‘make clean && make’ inside cudnn_samples_v8/mnistCUDNN folder, it gives error in linking as follows:

rm -rf *o
rm -rf mnistCUDNN
Linking agains cublasLt = true
CUDA VERSION: 10010
TARGET ARCH: x86_64
HOST_ARCH: x86_64
TARGET OS: linux
SMS: 35 50 53 60 61 62 70 72 75
/usr/bin/ld: cannot find -lcublasLt
/usr/bin/ld: cannot find -lcublas
collect2: error: ld returned 1 exit status

WARNING - FreeImage is not set up correctly. Please ensure FreeImage is set up correctly. <<<
[@] /usr/local/cuda/bin/nvcc -ccbin g++ -I/usr/local/cuda/include -I/usr/local/cuda/targets/ppc64le-linux/include -IFreeImage/include -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o fp16_dev.o -c fp16_dev.cu
[@] g++ -I/usr/local/cuda/include -I/usr/local/cuda/targets/ppc64le-linux/include -IFreeImage/include -o fp16_emu.o -c fp16_emu.cpp
[@] g++ -I/usr/local/cuda/include -I/usr/local/cuda/targets/ppc64le-linux/include -IFreeImage/include -o mnistCUDNN.o -c mnistCUDNN.cpp
[@] /usr/local/cuda/bin/nvcc -ccbin g++ -m64 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_53,code=sm_53 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_62,code=sm_62 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_72,code=sm_72 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_75,code=compute_75 -o mnistCUDNN fp16_dev.o fp16_emu.o mnistCUDNN.o -I/usr/local/cuda/include -I/usr/local/cuda/targets/ppc64le-linux/include -IFreeImage/include -L/usr/local/cuda/lib64 -L/usr/local/cuda/targets/ppc64le-linux/lib -lcublasLt -LFreeImage/lib/linux/x86_64 -LFreeImage/lib/linux -lcudart -lcublas -lcudnn -lfreeimage -lstdc++ -lm

I also tried both cudnn version 7.6.5 and 8.0.5 with cuda10.1, and they gave the same error. Any hints?

Hey… Thank you so much.
You saved me from so much trouble!

If all else fails, you can try compiling from source.

~/cudnn_samples_v8/mnistCUDNN$ less readme.txt
(you could use any reader to open it, I just used ‘less’ as an example)

There will be another readme for your distro in the FreeImage directory after you unzip the download. “readme.<your_distro>”
In Linux I still have the FreeImage directory in my downloads folder and it found it. That, I’m not sure why if found it, but it passed the test.
I moved it to my $HOME folder from Downloads and it’s still finding it. So idk about pathing, but it’s finding it somehow.
Ubuntu 20.04

This did work for me too.

this didn’t work for me, and I got this error
Err:1 Index of /ubuntu focal/universe amd64 libfreeimage3 amd64 3.18.0+ds2-1ubuntu3
Connection failed [IP: 185.125.190.39 80]

if anyone is facing this error after installing libfreeimage3

sudo apt-get install libfreeimage3 libfreeimage-dev

make sure to install the libcudnn-dev

eg.

sudo apt-get install libcudnn8-dev

1 Like
sudo apt-get install libfreeimage3 libfreeimage-dev

worked for me.

1 Like