Can't convert Voxel to VTK format

I can create .h5 plot file by this command

plot0 = openmc.Plot()
plot0.type = ‘voxel’
plot0.filename = ‘voxelPlot’
plot0.origin = [0, 0, 60]
plot0.basis = ‘yz’
plot0.width = [100,100,100]
plot0.pixels = [500,500,500]
plot0.overlap_color = ‘blue’
plot0.color_by = “material”
plot0.colors=color_dict
plot0.show_overlaps = True

and i got this file with 500 Mb size in the project folder.
image
And want to convert to VTK format.
After I run this command.

!openmc-voxel-to-vtk voxelPlot.h5 --output

I got an error without vtk file.

Traceback (most recent call last):
File “/Users/saksorn/opt/anaconda3/envs/openmc-env2/bin/openmc-voxel-to-vtk”, line 9, in
import vtk
File “/Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/python3.9/site-packages/vtk.py”, line 30, in
all_m = importlib.import_module(‘vtkmodules.all’)
File “/Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/python3.9/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “/Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/python3.9/site-packages/vtkmodules/all.py”, line 64, in
from .vtkIOFFMPEG import *
ImportError: dlopen(/Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/python3.9/site-packages/vtkmodules/vtkIOFFMPEG.cpython-39-darwin.so, 2): Symbol not found: _mp_get_memory_functions
Referenced from: /Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/libgnutls.30.dylib
Expected in: /Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/libhogweed.4.dylib
in /Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/libgnutls.30.dylib

Please help me to create the 3D plot. Thank you so much.

Hi @huak95. It looks like something is wrong with the VTK Python module. Notice that in the traceback, the line that leads to the error is:

import vtk

I’m not sure what exactly is wrong with it but would suggest reinstalling or upgrading the vtk module.

I use this command to reinstall the VTK Module
conda install -c anaconda vtk
and check the package by using

conda list

vtk 9.0.1 no_osmesa_py39h3dd132e_102 conda-forge

and use this input command

import vtk
!openmc-voxel-to-vtk voxelPlot.h5 --output

and got many error include import vtk


ImportError Traceback (most recent call last)
in
----> 1 import vtk
2 get_ipython().system(‘openmc-voxel-to-vtk voxelPlot.h5 --output’)

~/opt/anaconda3/envs/openmc-env2/lib/python3.9/site-packages/vtk.py in
28 import importlib
29 # import vtkmodules.all
—> 30 all_m = importlib.import_module(‘vtkmodules.all’)
31
32 # import vtkmodules

~/opt/anaconda3/envs/openmc-env2/lib/python3.9/importlib/init.py in import_module(name, package)
125 break
126 level += 1
→ 127 return _bootstrap._gcd_import(name[level:], package, level)
128
129

~/opt/anaconda3/envs/openmc-env2/lib/python3.9/site-packages/vtkmodules/all.py in
62 from .vtkIOImport import *
63 from .vtkIOVideo import *
—> 64 from .vtkIOFFMPEG import *
65 from .vtkIOExportPDF import *
66 from .vtkRenderingGL2PSOpenGL2 import *

ImportError: dlopen(/Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/python3.9/site-packages/vtkmodules/vtkIOFFMPEG.cpython-39-darwin.so, 2): Symbol not found: _mp_get_memory_functions
Referenced from: /Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/libgnutls.30.dylib
Expected in: /Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/libhogweed.4.dylib
in /Users/saksorn/opt/anaconda3/envs/openmc-env2/lib/libgnutls.30.dylib

Do you have a tutorial for 3D Plot? I really confuse what I need to do here. Thank you so much.

To be clear, this is not a problem with OpenMC itself and as far as I can tell what you are doing is correct. The openmc-voxel-to-vtk script depends on the VTK Python module and the problem is with your installation of the VTK Python module. It looks like the package for it on anaconda is only prebuilt for Python 3.6 and 3.7. You might want to try installing OpenMC in a new virtual environment based on Python 3.7. Alternatively, you can try uninstalling VTK from conda and then reinstalling using pip (pip install vtk).