PyVistaAttributeError when using MeshSeries.extract_probe in “Reading OGS Output: Diffusion, Sorption, and Decay in a 1D Reactive Transport Model” tutorial

Dear all,
While following the official OGS tutorial “Reading OGS Output: Diffusion, Sorption, and Decay in a 1D Reactive Transport Model”, I encountered a PyVistaAttributeError when trying to extract time series data at specific points using ogstools.MeshSeries.extract_probe.

Tutorial code snippet:

import ogstools as ot
import numpy as np

points = np.array([(0.0, 0.0, 419.4), (0.0, 0.0, 420.7)])
labels = [rf"$p_{{i}}$, $z = {pt[2]}\,$m" for i, pt in enumerate(points)]

# ms_pvd is loaded from the .pvd file as shown in the tutorial
ms_pts = [ot.MeshSeries.extract_probe(ms_pvd, pts, I129) for pts in points]

The error message:

PyVistaAttributeError: Attribute ‘filepath’ does not exist and cannot be added to class ‘PolyData’
Use pv.set_new_attribute to set new attributes or consider setting a private variable (with _ prefix) instead.

Additional information:

  • The .pvd file and associated data files exist and can be opened successfully in Jupyter notebook.
  • Loading the MeshSeries object from the .pvd file works without error.
  • My environment:
    • ogstools version: 0.7.0
    • pyvista version: 0.46.3
    • python version: 3.12.3
  • I have tried both passing all points as an array to extract_probe and invoking it point by point, but the error persists in both cases.
  • I suspect the issue could be due to ogstools and pyvista version compatibility, or possibly a problem with file path association within the MeshSeries object.

My questions:

  • Is there a recommended or correct usage for MeshSeries.extract_probe that avoids this error?
  • What are the common causes for this PyVistaAttributeError in the context of ogstools?
  • Should I downgrade/upgrade ogstools or pyvista, or is there a workaround?
  • Any other debugging or troubleshooting suggestions would be greatly appreciated.

Thank you for your help!

Hi Elexes,

the error is the same as this one.

If I remember correctly it’s caused by large PyVista restructurings in 0.46. So, as a solution, please try to downgrade PyVista, or rather try the approach (in a fresh virtual environment) in the issue above:

To prevent do pip install ogstools[ogs] , or even more conservative pip install ogstools[ogs,pinned] it should work

Best regards,
Christoph

Dear Christoph and the OGS community,

Thank you very much for your detailed and thoughtful response!

I have been primarily using the tutorial’s code to learn how Python integrates with OpenGeoSys, and I think this is a great starting point for me. Initially, I was quite worried that I might have made some mistakes causing this error. Now, knowing it is related to software version compatibility, I feel relieved and more confident.

I have already completed studying this part of the tutorial code successfully. Your suggestion to try downgrading PyVista or using a fresh virtual environment with the pinned version of ogstools is very helpful.

Thanks again for your attentive support!

Best regards,

Alex