Dolfinx install problem

Hi all,
I tried to install dolfinx and have successfully installed complex petsc. An error was reported when I tried to install dolfinx package:

  -- Check size of PetscInt
  -- Check size of PetscInt - failed
  -- Looking for PETSC_USE_COMPLEX
  -- Looking for PETSC_USE_COMPLEX - not found

Thank you in advance for any help.

You Need to supply more information about the installation. How Did you install petsc? What is $PETSC_DIR and $PETSC_ARCH Set to?

dokken, I have installed petsc with the following method,
1. python3 ./configure --COPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" --CXXOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" --FOPTFLAGS="${PETSC_SLEPC_OPTFLAGS}" --with-make-np=${PETSC_SLEPC_MAKE_NP} --with-64-bit-indices=no --with-debugging=${PETSC_SLEPC_DEBUGGING} --with-fortran-bindings=no --with-shared-libraries --download-hypre --download-metis --download-mumps --download-ptscotch --download-scalapack --download-suitesparse --download-superlu --download-superlu_dist --with-scalar-type=complex --download-cmake

Its result,

PETSc:
  PETSC_ARCH: linux-gnu-complex-32
  PETSC_DIR: /usr/local/petsc
  Prefix: <inplace installation>
  Scalar type: complex
  Precision: double
  Support for __float128
  Integer size: 4 bytes
  Single library: yes
  Shared libraries: yes
  Memory alignment from malloc(): 16 bytes
  Using GNU make: /usr/bin/make
xxx=========================================================================xxx
 Configure stage complete. Now build PETSc libraries with:
   make PETSC_DIR=/usr/local/petsc PETSC_ARCH=linux-gnu-complex-32 all
xxx=========================================================================xxx
2. sudo make PETSC_DIR=/usr/local/petsc PETSC_ARCH=linux-gn
u-complex-32 all

Its result,

          CC linux-gnu-complex-32/obj/mat/order/amd/amd.o
          CC linux-gnu-complex-32/obj/mat/impls/aij/mpi/mumps/mumps.o
          CC linux-gnu-complex-32/obj/dm/impls/da/hypre/mhyp.o
          CC linux-gnu-complex-32/obj/ksp/pc/impls/hypre/hypre.o
     CLINKER linux-gnu-complex-32/lib/libpetsc.so.3.16.0
=========================================
Now to check if the libraries are working do:
make PETSC_DIR=/usr/local/petsc PETSC_ARCH=linux-gnu-complex-32 check

$PETSC_DIR=/usr/local/petsc and $PETSC_ARCH=linux-gnu-complex-32

I found a similar report at this link cmake problem finding SLEPc: needs link to mpi · Issue #715 · FEniCS/dolfinx (github.com)

Have you exported PETSC_DIR and PETSC_ARCH as environment variables?
What happens if you call

echo $PETSC_DIR
echo $PETSC_ARCH

The echo results are /usr/local/petsc and linux-gnu-complex-32 respective. Now I used pip3 install . rather than sudo -E pip3 install ., and it works. I’ll test if I can import dolfinx.

Dear dokken,
Another error occurs when I import dolfinx and the message is,

In [1]: import dolfinx
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-7106aa1ed1ac> in <module>
----> 1 import dolfinx

~/.local/lib/python3.8/site-packages/dolfinx/__init__.py in <module>
     43 from .cpp.mesh import Topology, Geometry
     44
---> 45 from .fem.form import Form
     46 from .fem.dirichletbc import DirichletBC
     47 from .fem import (FunctionSpace, VectorFunctionSpace,

~/.local/lib/python3.8/site-packages/dolfinx/fem/__init__.py in <module>
      8
      9 from dolfinx.cpp.fem import IntegralType
---> 10 from dolfinx.fem.assemble import (apply_lifting, apply_lifting_nest,
     11                                   assemble_matrix, assemble_matrix_block,
     12                                   assemble_matrix_nest, assemble_scalar,

~/.local/lib/python3.8/site-packages/dolfinx/fem/assemble.py in <module>
     34
     35 form_type = typing.Union[Form, cpp.fem.Form, ufl.Form,
---> 36                          collections.abc.Sequence[Form],
     37                          collections.abc.Sequence[cpp.fem.Form],
     38                          collections.abc.Sequence[ufl.Form]]

TypeError: 'ABCMeta' object is not subscriptable

Does the source code have bug?

This has recently been fixed (as of 12 hours ago), Tweaks for building wheels by jhale · Pull Request #1740 · FEniCS/dolfinx · GitHub

Dear dokken,
Thank you very much. Since I used a dolfinx branch, another error occurred

Traceback (most recent call last):
  File "mesh.py", line 55, in <module>
    mesh, cell_tags, facet_tags = gmsh_model_to_mesh(
  File "/mnt/d/Workspace/fenics/return-stroke/test/gmsh_helpers.py", line 133, in gmsh_model_to_mesh
    facet_type = cell_entity_type(to_type(str(ufl_domain.ufl_cell())),
TypeError: cell_entity_type(): incompatible function arguments. The following argument types are supported:
    1. (arg0: dolfinx.cpp.mesh.CellType, arg1: int, arg2: int) -> dolfinx.cpp.mesh.CellType

Invoked with: <CellType.triangle: 3>, 1

Do you have any method to solve it?

Change the input of cell_entity_type to

# FIXME: Last argument is 0 as all facets are the same for tetrahedra
facet_type = cell_entity_type(to_type(str(ufl_domain.ufl_cell())), fdim, 0)

as shown in
https://jorgensd.github.io/dolfinx-tutorial/chapter2/ns_code2.html?highlight=cell_entity_type

Now dolfinx can successfully run. Thank you again.