schnellerhase / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
0 stars 0 forks source link

FIx debian package dev setup #8

Open schnellerhase opened 3 weeks ago

schnellerhase commented 3 weeks ago

Currently the dolfinx system does not pass a build with full installation based on the debian packages.

Dockerfile to reproduce the behavior:

FROM ubuntu:24.04

RUN apt-get update
RUN apt-get install -y python3-venv python3-dev \
    cmake \
    g++ \
    git \
    libboost-dev \
    libboost-timer-dev \
    libhdf5-mpi-dev \
    libopenblas-dev \
    libparmetis-dev \
    libpugixml-dev \
    libspdlog-dev \
    mpi-default-dev \
    ninja-build \
    petsc-dev \
    pkg-config

ENV VIRTUAL_ENV=/dolfinx-venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip install mpi4py nanobind scikit-build-core[pyproject] --upgrade

RUN pip install git+https://github.com/FEniCS/ufl.git
RUN pip install git+https://github.com/FEniCS/basix.git
RUN pip install git+https://github.com/FEniCS/ffcx.git

RUN pip install petsc4py

RUN git clone https://github.com/FEniCS/dolfinx.git /dolfinx
RUN mkdir /dolfinx/cpp/build
RUN cd /dolfinx/cpp/build && cmake .. -GNinja -D_REQUIRE_PETSC=ON && ninja install 

RUN cd /dolfinx/python && pip install .
RUN python /dolfinx/python/demo/demo_poisson.py

produces the output

Traceback (most recent call last):
  File "/dolfinx/python/demo/demo_poisson.py", line 70, in <module>
    import dolfinx
  File "/dolfinx-venv/lib/python3.12/site-packages/dolfinx/__init__.py", line 27, in <module>
    from dolfinx import fem, geometry, graph, io, jit, la, log, mesh, nls, plot, utils
  File "/dolfinx-venv/lib/python3.12/site-packages/dolfinx/utils.py", line 112, in <module>
    class ctypes_utils:
  File "/dolfinx-venv/lib/python3.12/site-packages/dolfinx/utils.py", line 133, in ctypes_utils
    _lib_ctypes = _ctypes.cdll.LoadLibrary(str(get_petsc_lib()))
                                               ^^^^^^^^^^^^^^^
  File "/dolfinx-venv/lib/python3.12/site-packages/dolfinx/utils.py", line 43, in get_petsc_lib
    raise RuntimeError("Could not find a PETSc shared library.")
RuntimeError: Could not find a PETSc shared library.

This originates from utils.py looking for a 'wrong' PETSc shared library name and non present arch config.

schnellerhase commented 2 weeks ago

Use --no-build-isolation for petsc4py`` and setPETSC_DIR` in Dockerfile