Installing VTK in Ubuntu 18.04

Hello I am following this link: to install VTK in my system. But having a lot of troubles while doing that.

According to them, I downloaded the Version(as the latest one is not supported by the CMakeLists.txt I am using)
I extracted the downloaded file in a VTK folder.
I have installed Cmake version 3.10.2

Then I follow instructions:

mkdir VTK-build
cd VTK-build
ccmake …/VTK

I am getting the following error:

CMake Error at CMake/vtkCompilerExtras.cmake:47 (if):
if given arguments:

 "cc: error: ARGS: No such file or directory

cc (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0

Copyright © 2017 Free Software Foundation, Inc.

This is free software" " see the source for copying conditions. There is



VTK 6.3 should work but I would advocate using a more recent version. 8.2 comes to mind.

1 Like

VTK prior to 7.1 has this weird compiler version detection logic that needs updated for any new version of GCC. VTK 7.1 finally got rid of the check completely in favor of CMake support for the flag that was being checked for.

I would also highly recommend VTK 8.2.0 instead of 6.3.

Here’s how I just built it on my Ubuntu 18.04 laptop and installed to $HOME/vtk-inst:

sudo apt install cmake libavcodec-dev libavformat-dev libavutil-dev libboost-dev libdouble-conversion-dev libeigen3-dev libexpat1-dev libfontconfig-dev libfreetype6-dev libgdal-dev libglew-dev libhdf5-dev libjpeg-dev libjsoncpp-dev liblz4-dev liblzma-dev libnetcdf-dev libnetcdf-cxx-legacy-dev libogg-dev libpng-dev libpython3-dev libqt5opengl5-dev libqt5x11extras5-dev libsqlite3-dev libswscale-dev libtheora-dev libtiff-dev libxml2-dev libxt-dev qtbase5-dev qttools5-dev zlib1g-dev
git clone
cd vtk
git checkout v8.2.0
mkdir build
cd build
    -DVTK_Group_Qt=ON \
    -DVTK_Group_Imaging=ON \
    -DVTK_Group_Views=ON \
    -DModule_vtkRenderingFreeTypeFontConfig=ON \
    -DPYTHON_EXECUTABLE=/usr/bin/python3 \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.6 \
    -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/ \
    -DCMAKE_BUILD_TYPE=Release \
make -j$(($(nproc) - 1))
make install

You are right, I reinstalled with 8.2 version and it worked.

Hi Elvis,
I am trying to install VTK 8.2 that may be required for another application. So, I tried to follow the commands you provided, but I get the following error:

nanay001@nanay001-Bonobo-WS:~/vtk-inst$ git clone
Cloning into ‘vtk’… Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Please advise

Use the https protocol instead :
git clone

I ran the same commands again, but with the above protocol, and seem to work. Could you show me how to check if it has installed VTK correctly?

VTK is not installed. You just cloned the source.

See here for building and installation :

I am confused. I thought that running the last command “make install”, as I have shown in my thread above, installed VTK. What is this line for, if it does not install VTK?

It does. I misunderstood your comment.

To check VTK is installed correctly, you can check ~/vtk-inst

how about
pip install vtk

1 Like

Excuse me, I would like to ask you, I changed the path after “=” to my absolute path, but I found that there is nothing under this folder, I would like to ask, then where is my final installation location? Please give me some advice. Thank you very much

Did you run make install (or ninja install)?

I run make install

That should output a bunch of information about where things are going. Does it match where you think they should be?

The final installation location does not match what I thought. I think the installation location should be under the corresponding folder after the “=”(

), but I don’t know where the actual installation location is, it seems to be under build, I don’t know how to confirm where it was last installed

Try this

make DESTDIR=/home/john install