--- a/python/demo/demo_scattering_boundary_conditions.py
+++ b/python/demo/demo_scattering_boundary_conditions.py
@@ -638,8 +638,11 @@
 Esh_dg = fem.Function(V_dg)
 Esh_dg.interpolate(Esh)
 
-with io.VTXWriter(domain.comm, "Esh.bp", Esh_dg) as vtx:
-    vtx.write(0.0)
+if hasattr(io,"VTXWriter"):
+    with io.VTXWriter(domain.comm, "Esh.bp", Esh_dg) as vtx:
+        vtx.write(0.0)
+else:
+    print("Cannot write Esh.bp: VTXWriter (adios2) is not available")
 # -
 
 # We visualize the solution using PyVista. For more information about
@@ -677,8 +680,11 @@
 E.x.array[:] = Eb.x.array[:] + Esh.x.array[:]
 E_dg = fem.Function(V_dg)
 E_dg.interpolate(E)
-with io.VTXWriter(domain.comm, "E.bp", E_dg) as vtx:
-    vtx.write(0.0)
+if hasattr(io,"VTXWriter"):
+    with io.VTXWriter(domain.comm, "E.bp", E_dg) as vtx:
+        vtx.write(0.0)
+else:
+    print("Cannot write E.bp: VTXWriter (adios2) is not available")
 # -
 
 # We validate our numerical solution by computing the absorption,
--- a/python/demo/demo_half_loaded_waveguide.py
+++ b/python/demo/demo_half_loaded_waveguide.py
@@ -482,11 +482,17 @@
         Et_dg.interpolate(eth)
 
         # Save solutions
-        with io.VTXWriter(msh.comm, f"sols/Et_{i}.bp", Et_dg) as f:
-            f.write(0.0)
+        if hasattr(io,"VTXWriter"):
+            with io.VTXWriter(msh.comm, f"sols/Et_{i}.bp", Et_dg) as f:
+                f.write(0.0)
+        else:
+            print(f"Cannot write sols/Et_{i}.bp: VTXWriter (adios2) is not available")
 
-        with io.VTXWriter(msh.comm, f"sols/Ez_{i}.bp", ezh) as f:
-            f.write(0.0)
+        if hasattr(io,"VTXWriter"):
+            with io.VTXWriter(msh.comm, f"sols/Ez_{i}.bp", ezh) as f:
+                f.write(0.0)
+        else:
+            print(f"Cannot write sols/Ez_{i}.bp: VTXWriter (adios2) is not available")
 
         # Visualize solutions with Pyvista
         if have_pyvista:
