Error in Fenicsx Tutorial?

Dear Mr. Dokken,

for my thesis I want to develop a script based on your example for hyperelasticity. Before modifying, I just wanted to make sure that everything works properly and copied all the elements of the example notebook without any manipulation into a .py file and ran this. Thereby, I got the error message

$ /usr/bin/python3
Traceback (most recent call last):
  File "/home/marco/Schreibtisch/Code
/Kernproblem/", line 29, in <module>
    left_dofs = fem.locate_dofs_topological(V, facet_tag.dim, facet_tag.find(1))
AttributeError: 'MeshTagsMetaClass' object has no attribute 'find'

That means that I cannot run your script as given on your example page. Could that depend on something I did not consider?

Some further information:

$ /usr/bin/python3 --version
Python 3.10.4

$ fenics-version 

$ dolfin-version 

Unfortunately, I could only request the versions of dolfin and fenics, not dolfinx and fenicsx as there exists no such command to request their versions.

In the hope that you can help me understand the problem
Best regards

Note: I wasn’t allowed to post the link to your example in that post. So, I send it here:

To Get the dolfinx version run the following:

python3 -c "import dolfinx;print(dolfinx.__version__, dolfinx.git_commit_hash)"

The result of the dolfinx version is:

$ /usr/bin/python3 -c "import dolfinx;print(dolfinx.__version__, dolfinx.git_commit_hash)"
0.4.1 unknown

Are you able to see a problem there?

The tutorial is almost up to date with main, which is at If you want to use the stable release, consider the notebooks at: GitHub - jorgensd/dolfinx-tutorial at v0.4.0

I tried that one, with the same error. My dolfin doesn’t know the facet_tag.find(1) command. I searched for a dolfinx update on apt, but to no avail. I can’t update it. How am I able to get that working?

The find command was exposed to the Python layer after the 0.4.1 release. As indicated in my link, you would have to use: facet_tag.indices[facet_tag.values==1]
as shown in: dolfinx-tutorial/hyperelasticity.ipynb at v0.4.0 · jorgensd/dolfinx-tutorial · GitHub

That helps! I am sorry I thought you mean that the .py-file and the notebook in said directory are equal and since I cannot use jupyter with dolfinx, I tend to use the .py files. I am sorry for that misunderstanding on my part.

Thank you so much for helping!