FEniCS / ffcx

Next generation FEniCS Form Compiler for finite element forms
https://fenicsproject.org
Other
145 stars 38 forks source link

AttributeError: module 'ffcx' has no attribute 'get_parameters' #611

Closed Henri-ColibrITD closed 10 months ago

Henri-ColibrITD commented 1 year ago

I just installed this library, on ubuntu, using the ppa.

add-apt-repository ppa:fenics-packages/fenics
apt update
apt install fenicsx

I tried installing as much dependencies as possible beforehand, but I was unable to install a few of them. but I thought that maybe this apt install fenicsx meant it all comes packaged, so I tried running the example from https://docs.fenicsproject.org/dolfinx/v0.6.0/python/demos/demo_poisson.html

The imports work but as soon as the second line of code, I hit a brick wall, any idea why that is ? and a possible fix ?

In [1]: from dolfinx import fem, io, mesh, plot
In [2]: import ufl
In [3]: import numpy as np
In [4]: from ufl import ds, dx, grad, inner
In [5]: from mpi4py import MPI
In [6]: from petsc4py.PETSc import ScalarType
In [7]: msh = mesh.create_rectangle(comm=MPI.COMM_WORLD,
   ...:                             points=((0.0, 0.0), (2.0, 1.0)), n=(32, 16),
   ...:                             cell_type=mesh.CellType.triangle,)
   ...: V = fem.FunctionSpace(msh, ("Lagrange", 1))
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-a50122d12f6d> in <module>
      2                             points=((0.0, 0.0), (2.0, 1.0)), n=(32, 16),
      3                             cell_type=mesh.CellType.triangle,)
----> 4 V = fem.FunctionSpace(msh, ("Lagrange", 1))

/usr/lib/petsc/lib/python3/dist-packages/dolfinx/fem/function.py in __init__(self, mesh, element, cppV, form_compiler_params, jit_params)
    441
    442         # Compile dofmap and element and create DOLFIN objects
--> 443         (self._ufcx_element, self._ufcx_dofmap), module, code = jit.ffcx_jit(
    444             mesh.comm, self.ufl_element(), form_compiler_params=form_compiler_params,
    445             jit_params=jit_params)

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

/usr/lib/petsc/lib/python3/dist-packages/dolfinx/jit.py in ffcx_jit(ufl_object, form_compiler_params, jit_params)
    197     """
    198     # Prepare form compiler parameters with priority parameters
--> 199     p_ffcx = ffcx.get_parameters(form_compiler_params)
    200     p_jit = get_parameters(jit_params)
    201

AttributeError: module 'ffcx' has no attribute 'get_parameters'
francesco-ballarin commented 10 months ago

This error typically occurs when you have mixed versions of ffcx and dolfinx. If this is still an issue, please open a post on https://fenicsproject.discourse.group/.