I am trying to use the vtkXdmfReader in Python to read a file. I was able to make this work on Windows with a pre-built Windows version of vtk without a hitch. Now I am trying this on Ubuntu and although vtk and its python bindings seem to install fine, vtkXdmfReader does not seem to install (module ‘vtk’ has no attribute ‘vtkXdmfReader’). Since the goal is to deploy in the cloud, I have a dockerfile that captures my config:
FROM ubuntu:18.04
USER root
RUN apt-get update && apt-get install -y python3-pip libgl1-mesa-dev xvfb
RUN useradd -ms /bin/bash mini
WORKDIR /home/mini
USER mini
RUN pip3 install h5py vtk
ENTRYPOINT /bin/bash
Now I build and run:
$ docker built -it mini .
$ docker run -it mini
mini@cc246a3bcbe8:~$ python3
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vtk
>>> vtk.vtkXdmfReader
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'vtk' has no attribute 'vtkXdmfReader'
However, it seems to be an otherwise fully functioning vtk install, e.g.:
>>> [a for a in dir(vtk) if a[:3] == 'vtk'][:25]
['vtk', 'vtk3DSImporter', 'vtk3DWidget', 'vtkAMRBaseParticlesReader', 'vtkAMRBaseReader', 'vtkAMRBox', 'vtkAMRCutPlane', 'vtkAMRDataInternals', 'vtkAMRDataSetCache', 'vtkAMREnzoParticlesReader', 'vtkAMREnzoReader', 'vtkAMRFlashParticlesReader', 'vtkAMRFlashReader', 'vtkAMRGaussianPulseSource', 'vtkAMRInformation', 'vtkAMRInterpolatedVelocityField', 'vtkAMRResampleFilter', 'vtkAMRSliceFilter', 'vtkAMRToMultiBlockFilter', 'vtkAMRUtilities', 'vtkASCIITextCodec', 'vtkAVSucdReader', 'vtkAbstractArray', 'vtkAbstractCellLinks', 'vtkAbstractCellLocator']
The wheel pip3 pulls is https://files.pythonhosted.org/packages/22/f5/30e11e1ad21701e1cd185b046979107930419a74a5602c6b899dc8523fe4/vtk-8.1.2-cp36-cp36m-manylinux1_x86_64.whl. I’ve also tried a conda install with the same end result. What am I missing?