Unable to found JIT module

Well, the title is the message error. Basically I have dolfin-x 0.3.0 installed (it is the one that comes with debian testing right now as far as I know), and I was looking into the documentation for this version for the poisson example:

I didn’t managed to replicate it as the command V = FunctionSpace(mesh, ("Lagrange", 1)) fails giving the next error message:

FileExistsError                           Traceback (most recent call last)
/usr/lib/python3/dist-packages/ffcx/codegeneration/jit.py in get_cached_module(module_name, object_names, cache_dir, timeout)
     61         # Create C file with exclusive access
---> 62         open(c_filename, "x")
     63         return None, None

FileExistsError: [Errno 17] File exists: '/home/manuel/.cache/fenics/libffcx_elements_0ba90af30174bac8aa16375eb5840f3f5018d54c.c'

During handling of the above exception, another exception occurred:

ModuleNotFoundError                       Traceback (most recent call last)
/tmp/ipykernel_469262/3084727201.py in <module>
      5     CellType.triangle, dolfinx.cpp.mesh.GhostMode.none)
----> 7 V = FunctionSpace(mesh, ("Lagrange", 1))

/usr/lib/petsc/lib/python3/dist-packages/dolfinx/fem/function.py in __init__(self, mesh, element, cppV, form_compiler_parameters, jit_parameters)
    384         # Compile dofmap and element and create DOLFIN objects
--> 385         (self._ufc_element, self._ufc_dofmap), module, code = jit.ffcx_jit(
    386             mesh.mpi_comm(), self.ufl_element(), form_compiler_parameters=form_compiler_parameters,
    387             jit_parameters=jit_parameters)

/usr/lib/petsc/lib/python3/dist-packages/dolfinx/jit.py in mpi_jit(comm, *args, **kwargs)
     60         # Just call JIT compiler when running in serial
     61         if comm.size == 1:
---> 62             return local_jit(*args, **kwargs)
     64         # Default status (0 == ok, 1 == fail)

/usr/lib/petsc/lib/python3/dist-packages/dolfinx/jit.py in ffcx_jit(ufl_object, form_compiler_parameters, jit_parameters)
    216         r = ffcx.codegeneration.jit.compile_forms([ufl_object], parameters=p_ffcx, **p_jit)
    217     elif isinstance(ufl_object, ufl.FiniteElementBase):
--> 218         r = ffcx.codegeneration.jit.compile_elements([ufl_object], parameters=p_ffcx, **p_jit)
    219     elif isinstance(ufl_object, ufl.Mesh):
    220         r = ffcx.codegeneration.jit.compile_coordinate_maps(

/usr/lib/python3/dist-packages/ffcx/codegeneration/jit.py in compile_elements(elements, parameters, cache_dir, timeout, cffi_extra_compile_args, cffi_verbose, cffi_debug, cffi_libraries)
    105     if cache_dir is not None:
    106         cache_dir = Path(cache_dir)
--> 107         obj, mod = get_cached_module(module_name, names, cache_dir, timeout)
    108         if obj is not None:
    109             # Pair up elements with dofmaps

/usr/lib/python3/dist-packages/ffcx/codegeneration/jit.py in get_cached_module(module_name, object_names, cache_dir, timeout)
     73                 spec = finder.find_spec(module_name)
     74                 if spec is None:
---> 75                     raise ModuleNotFoundError("Unable to find JIT module.")
     76                 compiled_module = importlib.util.module_from_spec(spec)
     77                 spec.loader.exec_module(compiled_module)

ModuleNotFoundError: Unable to find JIT module.

I don’t seem to find many people with this problem.

PS: I would like to add that the poisson example with dolfin (not the dolfin-x) seems to work properly. So for some reason I don’t understand dolfin finds the JIT but dolfin-x does not.

Your cache is probably corrupted, possibly due to version upgrades. Try deleting ~/.cache/fenics and try it again.

Thanks, works fine now. Not sure if I understood the problem although.

The hash in the file name is intended to established uniqueness of the jit file within the context of the build environment. i.e. to mark whether it needs to be regenerated or not (the fenics run is faster if it doesn’t). But the hash signature doesn’t yet capture every nuance in the build environment, leading to the problem you experienced. cf. increasing the entropy of the jit hash · Issue #290 · FEniCS/ffcx · GitHub

1 Like

I understand, thank you very much!