Search code examples
pythonnumpyimportvtkparaview

Converting numpy array into .vtk files using pyevtk


I have a numpy array that I want to convert into .vtk format so that I can later use it in ParaView. I installed pyevtk using pip install but when I import it using

from pyevtk.hl import gridToVTK

I get the error

No module named 'pyevtk'

Could someone please help me?

Thank you


Solution

  • Assuming, your python installation does not contain the pyevtk package, you'll have to make sure, it is properly installed. The installation procedure depends on your python installation.

    If you are using pip:

    pip install pyevtk
    

    If you are using conda/anaconda, you have to make sure to install from the conda-forge repository, as it is not available in the regular repository:

    conda install -c conda-forge pyevtk
    

    If the package has been installed successfully, using your code to should work fine.