Navier-Stokes demo throws an error

Hi everybody,
I am working in dolfinx. The command:

print(f"DOLFINx version: {dolfinx.__version__} based on GIT commit: {dolfinx.git_commit_hash} of https://github.com/FEniCS/dolfinx/")

produces:
DOLFINx version: 0.9.0 based on GIT commit: 24fc3ac6aa0fbf7301ae85f18e3fb4ad3b631452 of https://github.com/FEniCS/dolfinx/

My problem: the Navier-Stokes demo demo Navier-Stokes fails at running time:

File /home/myuser/anaconda3/envs/fenicsx-env/lib/python3.13/site-packages/dolfinx/fem/petsc.py, line 444, in assemble_matrix
   A = _cpp.fem.petsc.create_matrix(a._cpp_object)
                                     ^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute '_cpp_object'

Indeed, if I inspect the petsc.py file at that path, I find a petsc.py that does not correspond to the latest that can be found in the github repo. Here is an example of a function in my petsc.py differing form that of GitHub:

# FIXME: Revise this interface
@functools.singledispatch
def assemble_matrix_nest(
    a: list[list[Form]],
    bcs: list[DirichletBC] = [],
    mat_types=[],
    diagonal: float = 1.0,
    constants=None,
    coeffs=None,
) -> PETSc.Mat:
    """Create a nested matrix and assemble bilinear forms into the matrix.

    Args:
        a: Rectangular (list-of-lists) array for bilinear forms.
        bcs: Dirichlet boundary conditions.
        mat_types: PETSc matrix type for each matrix block.
        diagonal: Value to set on the matrix diagonal for Dirichlet
            boundary condition constrained degrees-of-freedom belonging
            to the same trial and test space.
        constants: Constants appearing the in the form.
        coeffs: Coefficients appearing the in the form.

    Returns:
        PETSc matrix (``MatNest``) representing the block of bilinear
        forms.
    """
    _a = [[None if form is None else form._cpp_object for form in arow] for arow in a]
    A = _cpp.fem.petsc.create_matrix_nest(_a, mat_types)
    _assemble_matrix_nest_mat(A, a, bcs, diagonal, constants, coeffs)
    return A

I just reinstalled anaconda3 as per anaconda3 tutorial and reinstalled Fenicsx as per tutorial.
I work in Ubuntu.

Am I missing something? How can I get the latest dolfinx and thus run the demo?

More context: I am implementing a solver for the unsteady Navier-Stokes eqs, and I am a bit baffled by the _nest/_block versions of algebraic constructors. I wanted to have a block problem reflecting its paper version,i.e. a residual form that is a list. I went for the _nest versions of the functions, and I have problems with the parallel run. I wanted to compare my implementation with the demo’s, but I cannot and here I am investigating the issue.

Thanks in advance.

Hello fras,
your output tells you that you have DOLFINx version 0.9.0 installed on your system. The demo you are trying to run seems to be from the main branch of the repo. The main branch of DOLFINx is ahead of the latest release and they are not compatible.

If you check out the repo at tag v0.9.0.post1, see Tags · FEniCS/dolfinx · GitHub and run the therein contained Navier Stokes demo it should run.

The current conda version of DOLFINx is also at v0.9.0 - same problem.

For executing demos on the main branch the nightly docker image is the easiest way to do so.

You are not looking at a demo from the correct version, ie:

which can also been found in

The version you are comparing with is the API will be available from 0.10, which will simplify the block/nest logic in DOLFINx significantly.