# How to check if MathText is supported without importing all of vtk?

**URL:** https://discourse.vtk.org/t/how-to-check-if-mathtext-is-supported-without-importing-all-of-vtk/16038
**Category:** Support
**Tags:** python
**Created:** [September 12, 2025, 6:49pm UTC](https://discourse.vtk.org/t/how-to-check-if-mathtext-is-supported-without-importing-all-of-vtk/16038 "2025-09-12T18:49:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![user27182](https://discourse.vtk.org/user_avatar/discourse.vtk.org/user27182/32/10104_2.png) [@user27182](https://discourse.vtk.org/u/user27182)
#### Post date: [September 12, 2025, 6:49pm UTC](https://discourse.vtk.org/t/how-to-check-if-mathtext-is-supported-without-importing-all-of-vtk/16038/1 "2025-09-12T18:49:03Z")

</div>

If I do:

```py
import vtkmodules.vtkRenderingFreeType
vtkmodules.vtkRenderingFreeType.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()

```

It returns `False`

But if I do instead:

```auto
import vtk
vtk.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()

```

It returns `True`.

I understand there are some factory classes that must be imported to do some magic: [Python Wrappers - VTK documentation](https://docs.vtk.org/en/latest/advanced/PythonWrappers.html#factories-and-implementation-modules)

`import vtkmodules.vtkRenderingFreeType` is listed as one of those magic imports, but yet importing this alone doesn’t seem to be enough. I also tried importing all three magic imports:

```auto
import vtkmodules.vtkRenderingFreeType
import vtkmodules.vtkRenderingOpenGL2
import vtkmodules.vtkInteractionStyle
vtkmodules.vtkRenderingFreeType.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()

```

But this still returns `False`.

What other imports are needed to make this work without importing _everything_? I can probably manually try importing each module one at a time but maybe someone knows the answer without needing to brute force this?

---

<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: [September 12, 2025, 7:42pm UTC](https://discourse.vtk.org/t/how-to-check-if-mathtext-is-supported-without-importing-all-of-vtk/16038/2 "2025-09-12T19:42:18Z")

</div>

```python
>>> import vtkmodules.vtkRenderingFreeType
>>> import vtkmodules.vtkRenderingMatplotlib
>>> vtkmodules.vtkRenderingFreeType.vtkMathTextFreeTypeTextRenderer().MathTextIsSupported()
True

```

In VTK, math text is implemented via matplotlib. So for math text to work, matplotlib must be installed, and vtkRenderingMatplotlib must be imported.

These implementation modules (RenderingOpenGL2, RenderingMatplotlib) can definitely be a headache.

---

<div class="post-metadata">

### Author: ![user27182](https://discourse.vtk.org/user_avatar/discourse.vtk.org/user27182/32/10104_2.png) [@user27182](https://discourse.vtk.org/u/user27182)
#### Post date: [September 12, 2025, 7:46pm UTC](https://discourse.vtk.org/t/how-to-check-if-mathtext-is-supported-without-importing-all-of-vtk/16038/3 "2025-09-12T19:46:32Z")

</div>

Thank you so much! `import vtkmodules.vtkRenderingMatplotlib` indeed was the missing link. I didn’t even know such a module existed.
