# Building VTK with OpenCascade support

**URL:** https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605
**Category:** Support
**Tags:** python
**Created:** [March 21, 2024, 1:13pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605 "2024-03-21T13:13:58Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![rrcpf](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rrcpf](https://discourse.vtk.org/u/rrcpf)
#### Post date: [March 21, 2024, 1:13pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/1 "2024-03-21T13:13:58Z")

</div>

Hello, I am interested in using VTK’s vtkOCCTReader to read Step files in my python project. From reading [Difficulty Accessing the vtkOCCTReader through the python modules](https://discourse.vtk.org/t/difficulty-accessing-the-vtkocctreader-through-the-python-modules/12588/2) it seems that the pip installation of VTK does not offer OpenCascade support so I need to build VTK on my own. I was able to build VTK using Cmake-gui which worked with other parts of my project but I still get the error " module ‘vtk’ has no attribute ‘vtkOCCTReader’". My question then is, how exactly do I enable OpenCascade support in my VTK build? I was not able to find “enable OpenCascade module” or something similar in cmake-gui as can be seen in the following image:

 ![VTKC-make](https://discourse.vtk.org/uploads/default/original/2X/5/524f06fb13d82587dfba4af5bc15bb613ea3b7a8.png)

---

<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: [March 21, 2024, 1:24pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/2 "2024-03-21T13:24:36Z")

</div>

Look for `VTK_MODULE_ENABLE_VTK_IOOCCT`, you will need to install open cascade though.

---

<div class="post-metadata">

### Author: ![rrcpf](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rrcpf](https://discourse.vtk.org/u/rrcpf)
#### Post date: [March 21, 2024, 4:56pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/3 "2024-03-21T16:56:12Z")

</div>

Thank you for the fast answer Mathieu. I have managed to find VTK\_MODULE\_ENABLE\_VTK\_IOOCCT, seems I forgot to click on the “Advanced” checkbox on cmake-gui and that was hiding it. I will attempt to install OpenCascade and then rebuild VTK correctly.

---

<div class="post-metadata">

### Author: ![rrcpf](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rrcpf](https://discourse.vtk.org/u/rrcpf)
#### Post date: [April 9, 2024, 2:38pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/4 "2024-04-09T14:38:59Z")

</div>

I have managed to install OpenCascade but while building VTK without the IOOCCT module works, every attempt at building with the module enabled gives me the error “ImportError: DLL load failed while importing vtkIOOCCT: The specified module could not be found” when running my project and I can’t really understand why that is.

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [April 10, 2024, 3:07am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/5 "2024-04-10T03:07:48Z")

</div>

Did you copy the OCCT dlls into your application folder?

---

<div class="post-metadata">

### Author: ![rrcpf](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/46a35a/32.png) [@rrcpf](https://discourse.vtk.org/u/rrcpf)
#### Post date: [April 10, 2024, 11:37am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/6 "2024-04-10T11:37:59Z")

</div>

I have added the path to the VTK folder to my PYTHONPATH environment variable and that seemed to work for builds without OpenCascade, even now when I look at the folder I can find the vtkIOOCCT dll and pyd files there so I don’t know why I am getting this error.

---

<div class="post-metadata">

### Author: ![FrontEnd\_Dev](https://discourse.vtk.org/user_avatar/discourse.vtk.org/frontend_dev/32/9717_2.png) [@FrontEnd\_Dev](https://discourse.vtk.org/u/FrontEnd_Dev)
#### Post date: [January 20, 2025, 6:54am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/7 "2025-01-20T06:54:06Z")

</div>

Hi,  
How to install OpenCascade on windows I have downloaded the .zip file provided [here](https://dev.opencascade.org/release) . But I don’t find any .exe or .msi for installation

---

<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: [January 20, 2025, 8:47am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/8 "2025-01-20T08:47:28Z")

</div>

Not a VTK question, however you need to compile it yourself using CMake and visual studio.

Alternatively, you could find a binary version to install or use a tool like vcpkg.

---

<div class="post-metadata">

### Author: ![FrontEnd\_Dev](https://discourse.vtk.org/user_avatar/discourse.vtk.org/frontend_dev/32/9717_2.png) [@FrontEnd\_Dev](https://discourse.vtk.org/u/FrontEnd_Dev)
#### Post date: [January 20, 2025, 8:54am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/9 "2025-01-20T08:54:05Z")

</div>

Thank you for the reply…  
I figured out the build using CMake, there is a flag USE\_VTK, should it be ticked?? Do I need to Tick all INSTALL\_XXX and USE\_XXX flags…

 ![image](https://discourse.vtk.org/uploads/default/original/2X/e/e9b5ebade431ee731a9f8f2480de54f11373bb64.png)

I am actually trying to use vtkOCCTReader in python and I have never worked with CPP or CMake.

---

<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: [January 20, 2025, 8:56am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/10 "2025-01-20T08:56:56Z")

</div>

> [@FrontEnd\_Dev](#):
>
> there is a flag USE\_VTK, should it be ticked??

No

> Do I need to Tick all INSTALL\_XXX and USE\_XXX flags…

Let them turned off and turn off a maximum of them.

You can look at VTK (actually ParaView) config for OCCT here:

[https://gitlab.kitware.com/paraview/paraview-superbuild/-/blob/master/projects/occt.cmake?ref\_type=heads](https://gitlab.kitware.com/paraview/paraview-superbuild/-/blob/master/projects/occt.cmake?ref_type=heads)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [January 20, 2025, 9:25am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/11 "2025-01-20T09:25:20Z")

</div>

@FrontEnd_Dev You are looking at the CMake config for building OpenCascade which is incorrect.

The first thing you should do is download the VTK source and build it with the default settings. Then check the VTK\_MODULE\_ENABLE\_VTK\_IOCCT flag.

---

<div class="post-metadata">

### Author: ![FrontEnd\_Dev](https://discourse.vtk.org/user_avatar/discourse.vtk.org/frontend_dev/32/9717_2.png) [@FrontEnd\_Dev](https://discourse.vtk.org/u/FrontEnd_Dev)
#### Post date: [January 20, 2025, 9:41am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/12 "2025-01-20T09:41:44Z")

</div>

Hi, I cloned the VTK repo and building using CMake  
VTK\_MODULE\_ENABLE\_VTK\_IOOCCT has a DEFAULT value should I make it YES?  
Any other settings I need to change

![image](https://discourse.vtk.org/uploads/default/original/2X/4/43dc171a7aab25f02d0144a095419d808750eaba.png)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [January 20, 2025, 9:45am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/13 "2025-01-20T09:45:19Z")

</div>

That’s what I would do. I expect the default value is NO. When you configure CMake it will then most likely require the OCCT source folder in a new variable.

---

<div class="post-metadata">

### Author: ![FrontEnd\_Dev](https://discourse.vtk.org/user_avatar/discourse.vtk.org/frontend_dev/32/9717_2.png) [@FrontEnd\_Dev](https://discourse.vtk.org/u/FrontEnd_Dev)
#### Post date: [January 20, 2025, 1:56pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/14 "2025-01-20T13:56:20Z")

</div>

Hi after I hit configure I got error for OpenCASCADE\_DIR  
Even I tried giving it the directory OpenCascade dir which I cloned from OpenCascade GitHub…

```auto

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
CMake Deprecation Warning at ThirdParty/tiff/vtktiff/CMakeLists.txt:32 (cmake_policy):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

CMake Warning (dev) at CMake/vtkModule.cmake:4883 (install):
  Policy CMP0177 is not set: install() DESTINATION paths are normalized. Run
  "cmake --help-policy CMP0177" for policy details. Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  ThirdParty/eigen/vtkeigen/CMakeLists.txt:733 (vtk_module_install_headers)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMake/vtkObjectFactory.cmake:101 (cmake_parse_arguments):
  The INITIAL_CODE keyword was followed by an empty string or no value at
  all. Policy CMP0174 is not set, so cmake_parse_arguments() will unset the
  _vtk_object_factory_configure_INITIAL_CODE variable rather than setting it
  to an empty string.
Call Stack (most recent call first):
  Rendering/UI/CMakeLists.txt:81 (vtk_object_factory_configure)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning at CMake/vtkModule.cmake:5351 (find_package):
  By not providing "FindOpenCASCADE.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "OpenCASCADE", but CMake did not find one.

  Could not find a package configuration file provided by "OpenCASCADE" with
  any of the following names:

    OpenCASCADEConfig.cmake
    opencascade-config.cmake

  Add the installation prefix of "OpenCASCADE" to CMAKE_PREFIX_PATH or set
  "OpenCASCADE_DIR" to a directory containing one of the above files. If
  "OpenCASCADE" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at CMake/vtkModule.cmake:5357 (message):
  Could not find the OpenCASCADE external dependency.
Call Stack (most recent call first):
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

Configuring incomplete, errors occurred!

```

---

<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: [January 20, 2025, 1:58pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/15 "2025-01-20T13:58:32Z")

</div>

> [@FrontEnd\_Dev](#):
>
> `Could not find a package configuration file provided`

Did you compiled and installed OpenCascade first ?

---

<div class="post-metadata">

### Author: ![FrontEnd\_Dev](https://discourse.vtk.org/user_avatar/discourse.vtk.org/frontend_dev/32/9717_2.png) [@FrontEnd\_Dev](https://discourse.vtk.org/u/FrontEnd_Dev)
#### Post date: [January 20, 2025, 2:05pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/16 "2025-01-20T14:05:19Z")

</div>

Hey I just did and gave the build path of OpenCascade and now getting this error

```auto
Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
CMake Deprecation Warning at ThirdParty/tiff/vtktiff/CMakeLists.txt:32 (cmake_policy):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.

CMake Warning (dev) at CMake/vtkModule.cmake:4883 (install):
  Policy CMP0177 is not set: install() DESTINATION paths are normalized. Run
  "cmake --help-policy CMP0177" for policy details. Use the cmake_policy
  command to set the policy and suppress this warning.
Call Stack (most recent call first):
  ThirdParty/eigen/vtkeigen/CMakeLists.txt:733 (vtk_module_install_headers)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMake/vtkObjectFactory.cmake:101 (cmake_parse_arguments):
  The INITIAL_CODE keyword was followed by an empty string or no value at
  all. Policy CMP0174 is not set, so cmake_parse_arguments() will unset the
  _vtk_object_factory_configure_INITIAL_CODE variable rather than setting it
  to an empty string.
Call Stack (most recent call first):
  Rendering/UI/CMakeLists.txt:81 (vtk_object_factory_configure)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:47:
  Syntax Warning in cmake code at column 75

  Argument not separated from preceding token by whitespace.
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:102 (include):
  include could not find requested file:

    D:/Work2/OCCT/build/OpenCASCADEFoundationClassesTargets.cmake
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:102 (include):
  include could not find requested file:

    D:/Work2/OCCT/build/OpenCASCADEModelingDataTargets.cmake
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:102 (include):
  include could not find requested file:

    D:/Work2/OCCT/build/OpenCASCADEModelingAlgorithmsTargets.cmake
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:102 (include):
  include could not find requested file:

    D:/Work2/OCCT/build/OpenCASCADEVisualizationTargets.cmake
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:102 (include):
  include could not find requested file:

    D:/Work2/OCCT/build/OpenCASCADEApplicationFrameworkTargets.cmake
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:102 (include):
  include could not find requested file:

    D:/Work2/OCCT/build/OpenCASCADEDataExchangeTargets.cmake
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:102 (include):
  include could not find requested file:

    D:/Work2/OCCT/build/OpenCASCADEDEToolsTargets.cmake
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at D:/Work2/OCCT/build/OpenCASCADEConfig.cmake:102 (include):
  include could not find requested file:

    D:/Work2/OCCT/build/OpenCASCADEDrawTargets.cmake
Call Stack (most recent call first):
  CMake/vtkModule.cmake:5351 (find_package)
  IO/OCCT/CMakeLists.txt:1 (vtk_module_find_package)

CMake Error at IO/OCCT/CMakeLists.txt:35 (message):
  Found OpenCASCADE (D:/Work2/OCCT/build) is missing the following required
  targets: TKDESTEP, TKDEIGES, TKernel, TKMath, TKMesh, TKBRep, TKXSBase,
  TKLCAF, TKXCAF

Configuring incomplete, errors occurred!

```

---

<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: [January 20, 2025, 2:25pm UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/17 "2025-01-20T14:25:39Z")

</div>

> [@FrontEnd\_Dev](#):
>
> ```auto
> Found OpenCASCADE (D:/Work2/OCCT/build) is missing the following required
> targets: TKDESTEP, TKDEIGES, TKernel, TKMath, TKMesh, TKBRep, TKXSBase,
> TKLCAF, TKXCAF
> 
> ```

Make sure to enable these module in your configuration of opencascade, as I suggested above

[https://gitlab.kitware.com/paraview/paraview-superbuild/-/blob/master/projects/occt.cmake?ref\_type=heads](https://gitlab.kitware.com/paraview/paraview-superbuild/-/blob/master/projects/occt.cmake?ref_type=heads)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [January 21, 2025, 3:15am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/18 "2025-01-21T03:15:09Z")

</div>

Does `D:/Work2/OCCT/build/OpenCASCADEModelingDataTargets.cmake` exist?

---

<div class="post-metadata">

### Author: ![FrontEnd\_Dev](https://discourse.vtk.org/user_avatar/discourse.vtk.org/frontend_dev/32/9717_2.png) [@FrontEnd\_Dev](https://discourse.vtk.org/u/FrontEnd_Dev)
#### Post date: [January 21, 2025, 5:42am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/19 "2025-01-21T05:42:00Z")

</div>

Nope it does not…  
These are all the CMAKE files in D:/Work2/OCCT/build/

![image](https://discourse.vtk.org/uploads/default/original/2X/d/d0580570bc4751e0bb1d353e1dc6c6f289965659.png)

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [January 21, 2025, 5:46am UTC](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605/20 "2025-01-21T05:46:15Z")

</div>

The file should be in `D:\Work2\OCCT\build\CMakeFiles\Export\cmake`

If it is not there then OpenCascade has not been built properly.

[Next page](https://discourse.vtk.org/t/building-vtk-with-opencascade-support/13605.md?page=2)
