No module named 'dolfin.cpp' using Ubuntu

I’m trying to use dolfin in a python script called BG_demo.py (circled in red). I’m getting the error “No module named ‘dolfin.cpp’”. It seems that the dolfin init file cannot find dolfin.cpp, which is located in C:\Users\jfrut\python\src (circled in blue).

I tried pasting the dolfin.cpp file in the same location as both BG_demo.py and the dolfin init file (located in the dolfin folder circled in yellow) to no avail. Why is this happening?

There’s a couple of things going on there. The error message is referring to the python module, not the source file. It means you haven’t installed dolfin yet.

Note that dolfin is the old legacy version of FENiCS. For new projects you ought to use dolfinx instead.

Installation instructions for Ubuntu can be found at GitHub - FEniCS/dolfinx: Next generation FEniCS problem solving environment