# installation of vtk 9.0 with python, java wrappers

**URL:** https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325
**Category:** Support
**Created:** [May 18, 2020, 2:37pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325 "2020-05-18T14:37:07Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Sohrab\_Azami](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sohrab_azami/32/1210_2.png) [@Sohrab\_Azami](https://discourse.vtk.org/u/Sohrab_Azami)
#### Post date: [May 18, 2020, 2:37pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/1 "2020-05-18T14:37:07Z")

</div>

hi all,

I tried to install java and python wrappers in order to use them for calling VTK APIs, over last three days I have tried different approaches. first VTK\_BUILD?SHARED checked in CMake apparently that failed in installation stage because of missing .pyd library file for python, I guess it was vtkIOVeraOut.cp36-win.amd64.pyd if I am not wrong. I search the download vtk source files and could not find it. then I tried to install it in release mode and that also failed, today I tried to uncheck VTK\_BUILD\_SHARED so everything builds and I still have problems building, I saw a project failed to build at project number 490, and some other problems raised with my pc after 10 hours of continues build of vtk 9.0.

Q. has anybody managed to include java and python wrappers checked in CMake and succeeded to install VTK 9.0,

help is needed , I appreciate in advance!!

Regards,  
sohrab

---

<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: [May 18, 2020, 3:11pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/2 "2020-05-18T15:11:52Z")

</div>

Could you post the actual errors you get from the compiler and/or build?

---

<div class="post-metadata">

### Author: ![Sohrab\_Azami](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sohrab_azami/32/1210_2.png) [@Sohrab\_Azami](https://discourse.vtk.org/u/Sohrab_Azami)
#### Post date: [May 19, 2020, 6:11am UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/3 "2020-05-19T06:11:25Z")

</div>

Hi Ben,

CMake Configuration:

1. wrapping for java and python is checked!

2. BUILD\_SHARED\_LIBS UNCHECKED!.

3. config + generate -\> vtk.sln is in bin folder of vtk build from code!

VS2017 BUILD: X64, DEBUG, ALL\_BUILD-\>BUILD

FOLLOWING IS THE OUTPUT SCREEN OF COMPILE + LINK IN VS2017

[errors.txt](https://discourse.vtk.org/uploads/short-url/ztTd4kfgwgFHT3als4dSDLk1H84.txt) (1.27 MB)

---

<div class="post-metadata">

### Author: ![Sohrab\_Azami](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sohrab_azami/32/1210_2.png) [@Sohrab\_Azami](https://discourse.vtk.org/u/Sohrab_Azami)
#### Post date: [May 19, 2020, 6:19am UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/4 "2020-05-19T06:19:58Z")

</div>

@ben,  
CMake is used to generate a vtk.sln solution for vs2017  
EDI: (VS2017 + x64/debug) build  
I just responded to your email from my gmail. I hope that helps, As I explained the errors are for a static build BUILD\_SHARED\_LIBS IS UNCHECKED! I also have missing libraries which I hope it is because of compilation errors which consequently resulted in missing libraries.

Missing libraries:  
…/…/lib/debug/vtkCommonExecutionModelJava.lib  
…/…/lib/debug/vtkCommonCoreJava.lib  
what do you think the compilation errors resulted in not building these libraries so they are missing!?

Regards,  
Sohrab Azami

---

<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: [May 19, 2020, 10:34am UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/5 "2020-05-19T10:34:54Z")

</div>

I don’t know how well Java support with static libraries is supported. It looks like “not 100%”. I suggest doing a shared build if you need Java right now. If you chase the errors back to the source, you find this output:

```auto
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(45): error C2375: 'vtkJavaGetPointerFromObject': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(28): note: see declaration of 'vtkJavaGetPointerFromObject'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(50): error C2375: 'vtkJavaMakeJArrayOfDoubleFromDouble': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(37): note: see declaration of 'vtkJavaMakeJArrayOfDoubleFromDouble'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(75): error C2375: 'vtkJavaMakeJArrayOfDoubleFromFloat': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(35): note: see declaration of 'vtkJavaMakeJArrayOfDoubleFromFloat'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(100): error C2375: 'vtkJavaMakeJArrayOfIntFromInt': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(41): note: see declaration of 'vtkJavaMakeJArrayOfIntFromInt'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(125): error C2375: 'vtkJavaMakeJArrayOfIntFromIdType': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(42): note: see declaration of 'vtkJavaMakeJArrayOfIntFromIdType'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(150): error C2375: 'vtkJavaMakeJArrayOfIntFromLongLong': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(44): note: see declaration of 'vtkJavaMakeJArrayOfIntFromLongLong'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(175): error C2375: 'vtkJavaMakeJArrayOfIntFromSignedChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(46): note: see declaration of 'vtkJavaMakeJArrayOfIntFromSignedChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(200): error C2375: 'vtkJavaMakeJArrayOfFloatFromFloat': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(33): note: see declaration of 'vtkJavaMakeJArrayOfFloatFromFloat'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(225): error C2375: 'vtkJavaMakeJArrayOfShortFromShort': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(39): note: see declaration of 'vtkJavaMakeJArrayOfShortFromShort'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(250): error C2375: 'vtkJavaMakeJArrayOfByteFromUnsignedChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(50): note: see declaration of 'vtkJavaMakeJArrayOfByteFromUnsignedChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(276): error C2375: 'vtkJavaMakeJArrayOfLongFromLong': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(48): note: see declaration of 'vtkJavaMakeJArrayOfLongFromLong'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(302): error C2375: 'vtkJavaMakeJArrayOfUnsignedLongFromUnsignedLong': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(62): note: see declaration of 'vtkJavaMakeJArrayOfUnsignedLongFromUnsignedLong'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(329): error C2375: 'vtkJavaMakeJArrayOfUnsignedShortFromUnsignedShort': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(60): note: see declaration of 'vtkJavaMakeJArrayOfUnsignedShortFromUnsignedShort'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(356): error C2375: 'vtkJavaMakeJArrayOfUnsignedCharFromUnsignedChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(56): note: see declaration of 'vtkJavaMakeJArrayOfUnsignedCharFromUnsignedChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(383): error C2375: 'vtkJavaMakeJArrayOfUnsignedIntFromUnsignedInt': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(58): note: see declaration of 'vtkJavaMakeJArrayOfUnsignedIntFromUnsignedInt'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(410): error C2375: 'vtkJavaMakeJArrayOfCharFromChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(54): note: see declaration of 'vtkJavaMakeJArrayOfCharFromChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(517): error C2375: 'vtkJavaUTFToChar': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(29): note: see declaration of 'vtkJavaUTFToChar'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(522): error C2375: 'vtkJavaUTFToString': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(30): note: see declaration of 'vtkJavaUTFToString'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(535): error C2375: 'vtkJavaMakeJavaString': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(31): note: see declaration of 'vtkJavaMakeJavaString'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(565): error C2375: 'vtkJavaVoidFunc': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(74): note: see declaration of 'vtkJavaVoidFunc'
92>C:\vtk\src\Utilities\Java\vtkJavaUtil.cxx(582): error C2375: 'vtkJavaVoidFuncArgDelete': redefinition; different linkage
92>c:\vtk\src\utilities\java\vtkJavaUtil.h(75): note: see declaration of 'vtkJavaVoidFuncArgDelete'

```

Cc: @dgobbi

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [May 19, 2020, 12:55pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/6 "2020-05-19T12:55:51Z")

</div>

Hi Sohrab,

VTK can often be tricky to build, especially with Python and Java wrappers, but it can definitely be done. It’s even done as part of the automated nightly testing.

However, there are some considerations:

1. If you want to build the wrappers, set BUILD\_SHARED\_LIBS to ON. Otherwise, the wrappers will not work as you expect. Trying to build the wrappers with static libraries is just a waste of time unless you really need static libraries.

2. For VTK 9.0, building the Java wrappers inside Visual Studio will not work. Right now, the only way to build Java wrapping on Windows is from the “VS Developer Command Prompt” with the Ninja generator. This will probably be fixed for VTK 9.1.

VTK 9.0 also has issues with embedding the VTK render window within a Java GUI, this should also be fixed in 9.1.

In summary, I think your best option right now is to only use Python wrapping (and definitely check BUILD\_SHARED\_LIBS). For Java, wait for VTK 9.1.

@ben.boeckel I can check the attributes and specifiers for the generated Java methods. But it’s probably worth repeating that I’m really no expert on the Java wrapping, and I’m not even a Java programmer.

---

<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: [May 19, 2020, 1:50pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/7 "2020-05-19T13:50:33Z")

</div>

> [@dgobbi](#):
>
> For Java, wait for VTK 9.1.

We might be able to get the Java fixes into 9.0.1: [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/6902](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/6902)

> [@dgobbi](#):
>
> I can check the attributes and specifiers for the generated Java methods. But it’s probably worth repeating that I’m really no expert on the Java wrapping, and I’m not even a Java programmer.

These are attributes on the `vtkJavaUtil` functions. I don’t think there’s any generated code in that error message.

---

<div class="post-metadata">

### Author: ![Sohrab\_Azami](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sohrab_azami/32/1210_2.png) [@Sohrab\_Azami](https://discourse.vtk.org/u/Sohrab_Azami)
#### Post date: [May 19, 2020, 2:38pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/8 "2020-05-19T14:38:01Z")

</div>

Hi ben  
Firstly Thank you sir about your help, secondly I don’t know how to run build from vs developers command prompt with ninja generator!? I will do CMake with BUILD\_SHARED\_LIBS! afterwards what is the command line for build from command prompt with ninja generator!?

I appreciate your help in advance

Regards,

Sohrab Azami

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [May 19, 2020, 4:07pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/9 "2020-05-19T16:07:29Z")

</div>

Hi Sohrab,

The “x64 Native Tools Command Prompt” is in the Windows Start menu (under the Visual Studio 2017 menu).

Once you are in the command prompt, all the build commands should be run from this prompt. First, you should “cd” to your build folder, and then you can run cmake, and then ninja:

```auto
cd \path\to\vtk-build
cmake ..\vtk-source -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DVTK_WRAP_JAVA=ON -D VTK_WRAP_PYTHON=ON
ninja

```

The visual studio command prompt comes with “cmake” and “ninja” as built-in commands, so you don’t even have to download ninja yourself.

---

<div class="post-metadata">

### Author: ![Sohrab\_Azami](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sohrab_azami/32/1210_2.png) [@Sohrab\_Azami](https://discourse.vtk.org/u/Sohrab_Azami)
#### Post date: [May 19, 2020, 5:18pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/10 "2020-05-19T17:18:19Z")

</div>

@dgobbi

Firstly thank you for your response. secondly I followed the instruction you wrote in your message:  
cmake …\src -GNinja -DCMAKE\_BUILD\_TYPE=Debug -DBUILD\_SHARED\_LIBS=ON -DVTK\_WRAP\_JAVA=ON -DVTK\_WRAP\_PYTHON=ON ninja

but I received error message: CMake Error: The source directory c:\vtk\bin\ninja does not exist specify --help for usage, or press the help button on the CMake GUI.

Please inform me what do you make of this error message and how could I do ninja generation of my source code and built VTK tool  
I appreciate your help in advance

Sohrab azami

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [May 19, 2020, 5:27pm UTC](https://discourse.vtk.org/t/installation-of-vtk-9-0-with-python-java-wrappers/3325/11 "2020-05-19T17:27:06Z")

</div>

You put “ninja” at the end of your cmake command. This is wrong, ninja is a separate command to run _after_ you run cmake. Take another look at my example above.

After doing the build with “ninja”, type “ninja install” to do the actual installation.
