# Installing VTK in Ubuntu 18.04

**URL:** https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147
**Category:** Support
**Created:** [November 25, 2019, 10:53pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147 "2019-11-25T22:53:51Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![banikr](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/b9bd4f/32.png) [@banikr](https://discourse.vtk.org/u/banikr)
#### Post date: [November 25, 2019, 10:53pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/1 "2019-11-25T22:53:51Z")

</div>

Hello I am following this link: [VTK/Building/Linux - KitwarePublic](https://vtk.org/Wiki/VTK/Building/Linux) to install VTK in my system. But having a lot of troubles while doing that.

According to them, I downloaded the VTK-6.3.0.zip 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 (C) 2017 Free Software Foundation, Inc.
> 
> This is free software" " see the source for copying conditions. There is  
> NO
> 
> warranty" " not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR  
> PURPOSE.
> 
> " “VERSION\_GREATER” “4.2.0” “AND” “BUILD\_SHARED\_LIBS” “AND”

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [November 26, 2019, 8:48am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/2 "2019-11-26T08:48:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [November 26, 2019, 11:22am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/3 "2019-11-26T11:22:50Z")

</div>

> [@banikr](#):
>
> "cc: error: ARGS: No such file or directory

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.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [November 26, 2019, 3:47pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/4 "2019-11-26T15:47:10Z")

</div>

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`:

```auto
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 git@gitlab.kitware.com:vtk/vtk.git
cd vtk
git checkout v8.2.0
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=$HOME/vtk-inst \
    -DCMAKE_INSTALL_RPATH=$HOME/vtk-inst \
    -DVTK_Group_Qt=ON \
    -DVTK_QT_VERSION=5 \
    -DVTK_Group_Imaging=ON \
    -DVTK_Group_Views=ON \
    -DModule_vtkRenderingFreeTypeFontConfig=ON \
    -DVTK_WRAP_PYTHON=ON \
    -DVTK_PYTHON_VERSION=3 \
    -DPYTHON_EXECUTABLE=/usr/bin/python3 \
    -DPYTHON_INCLUDE_DIR=/usr/include/python3.6 \
    -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \
    -DBUILD_TESTING=OFF \
    -DVTK_USE_SYSTEM_LIBRARIES=ON \
    -DVTK_USE_SYSTEM_LIBPROJ4=OFF \
    -DVTK_USE_SYSTEM_GL2PS=OFF \
    -DVTK_USE_SYSTEM_LIBHARU=OFF \
    -DVTK_USE_SYSTEM_PUGIXML=OFF \
    -DCMAKE_BUILD_TYPE=Release \
    ..
make -j$(($(nproc) - 1))
make install

```

---

<div class="post-metadata">

### Author: ![banikr](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/b9bd4f/32.png) [@banikr](https://discourse.vtk.org/u/banikr)
#### Post date: [November 26, 2019, 6:47pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/5 "2019-11-26T18:47:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![nanay001](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/6a8cbe/32.png) [@nanay001](https://discourse.vtk.org/u/nanay001)
#### Post date: [February 16, 2020, 3:40pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/6 "2020-02-16T15:40:29Z")

</div>

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 [git@gitlab.kitware.com](mailto:git@gitlab.kitware.com):vtk/vtk.git**  
**Cloning into ‘vtk’…**  
**[git@gitlab.kitware.com](mailto:git@gitlab.kitware.com): Permission denied (publickey).**  
**fatal: Could not read from remote repository.**

**Please make sure you have the correct access rights**  
**and the repository exists.**  
**nanay001@nanay001-Bonobo-WS:~/vtk-inst$**

Please advise

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [February 17, 2020, 3:34am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/7 "2020-02-17T03:34:44Z")

</div>

Use the https protocol instead :  
`git clone https://gitlab.kitware.com/vtk/vtk.git`

---

<div class="post-metadata">

### Author: ![nanay001](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/6a8cbe/32.png) [@nanay001](https://discourse.vtk.org/u/nanay001)
#### Post date: [February 17, 2020, 5:09am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/8 "2020-02-17T05:09:43Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [February 17, 2020, 5:13am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/9 "2020-02-17T05:13:40Z")

</div>

VTK is not installed. You just cloned the source.

See here for building and installation :

[https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/build.md](https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/build.md)

---

<div class="post-metadata">

### Author: ![nanay001](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/n/6a8cbe/32.png) [@nanay001](https://discourse.vtk.org/u/nanay001)
#### Post date: [February 18, 2020, 2:54am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/10 "2020-02-18T02:54:39Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [February 18, 2020, 3:02am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/11 "2020-02-18T03:02:22Z")

</div>

It does. I misunderstood your comment.

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

---

<div class="post-metadata">

### Author: ![ahmed\_shingaly](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ahmed_shingaly/32/2281_2.png) [@ahmed\_shingaly](https://discourse.vtk.org/u/ahmed_shingaly)
#### Post date: [September 3, 2020, 5:06am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/12 "2020-09-03T05:06:50Z")

</div>

how about  
pip install vtk

---

<div class="post-metadata">

### Author: ![yuantangjin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yuantangjin/32/3678_2.png) [@yuantangjin](https://discourse.vtk.org/u/yuantangjin)
#### Post date: [July 18, 2021, 11:54am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/13 "2021-07-18T11:54:38Z")

</div>

> [@estan](#):
>
> `-DCMAKE_INSTALL_PREFIX=$HOME/vtk-inst `

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 18, 2021, 12:24pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/14 "2021-07-18T12:24:48Z")

</div>

Did you run `make install` (or `ninja install`)?

---

<div class="post-metadata">

### Author: ![yuantangjin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yuantangjin/32/3678_2.png) [@yuantangjin](https://discourse.vtk.org/u/yuantangjin)
#### Post date: [July 18, 2021, 12:26pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/15 "2021-07-18T12:26:01Z")

</div>

> [@ben.boeckel](#):
>
> run `make install`

I run `make install`

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [July 18, 2021, 1:33pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/16 "2021-07-18T13:33:21Z")

</div>

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

---

<div class="post-metadata">

### Author: ![yuantangjin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yuantangjin/32/3678_2.png) [@yuantangjin](https://discourse.vtk.org/u/yuantangjin)
#### Post date: [July 18, 2021, 1:41pm UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/17 "2021-07-18T13:41:40Z")

</div>

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

> [@estan](#):
>
> `=$HOME/vtk-inst`

）, 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

---

<div class="post-metadata">

### Author: ![pranjal.sahu](https://discourse.vtk.org/user_avatar/discourse.vtk.org/pranjal.sahu/32/6052_2.png) [@pranjal.sahu](https://discourse.vtk.org/u/pranjal.sahu)
#### Post date: [July 20, 2021, 1:36am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/18 "2021-07-20T01:36:00Z")

</div>

Try this  
[https://cmake.org/cmake/help/v3.0/variable/CMAKE\_INSTALL\_PREFIX.html](https://cmake.org/cmake/help/v3.0/variable/CMAKE_INSTALL_PREFIX.html)

make DESTDIR=/home/john install

---

<div class="post-metadata">

### Author: ![tkeskita](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tkeskita/32/1757_2.png) [@tkeskita](https://discourse.vtk.org/u/tkeskita)
#### Post date: [March 27, 2022, 7:08am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/19 "2022-03-27T07:08:11Z")

</div>

> [@ben.boeckel](#):
>
> > [@](#):
> >
> > "cc: error: ARGS: No such file or directory
> 
> VTK prior to 7.1 has this weird compiler version detection logic that needs updated for any new version of GCC.

Tip for anyone out there who needs to build an older VTK version and get the error `cc: error: ARGS: No such file or directory`: This error seems to come from variable `_gcc_version`. You need to modify the REGEX MATCH above the `_gcc_version` line for each cmake file which raises the error. I did it by adding more digits to the regex, like so:  
`string(REGEX MATCH "[3456789]\\.[0-9]\\.[0-9]*"`  
I was able to compile VTK 6.2.0 on Ubuntu 20.04 this way.

---

<div class="post-metadata">

### Author: ![winter\_mouse](https://discourse.vtk.org/user_avatar/discourse.vtk.org/winter_mouse/32/5094_2.png) [@winter\_mouse](https://discourse.vtk.org/u/winter_mouse)
#### Post date: [May 16, 2022, 12:05am UTC](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147/20 "2022-05-16T00:05:19Z")

</div>

Hello, I am trying to compile VTK 8.2 in ubuntu 22 but stuck with this error. Can I get some help?

```auto
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LibPROJ (missing: LibPROJ_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  CMake/FindLibPROJ.cmake:43 (find_package_handle_standard_args)
  CMake/vtkModuleMacros.cmake:891 (find_package)
  ThirdParty/libproj/CMakeLists.txt:1 (vtk_module_third_party)

```

[Next page](https://discourse.vtk.org/t/installing-vtk-in-ubuntu-18-04/2147.md?page=2)
