From 2eec6eb001e326f59d51d709e00343d6a7d0be09 Mon Sep 17 00:00:00 2001 From: qbisi Date: Fri, 8 Aug 2025 04:25:22 +0800 Subject: [PATCH] python3Packages.fenics: drop fenics is broken and deprecated, use fenics-dolfinx instead. --- nixos/tests/all-tests.nix | 1 - nixos/tests/fenics.nix | 51 --- .../python-modules/fenics/default.nix | 311 ------------------ pkgs/top-level/python-aliases.nix | 1 + pkgs/top-level/python-packages.nix | 2 - 5 files changed, 1 insertion(+), 365 deletions(-) delete mode 100644 nixos/tests/fenics.nix delete mode 100644 pkgs/development/python-modules/fenics/default.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 4ce282532ef7..55b4bdc4b8a7 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -506,7 +506,6 @@ in fanout = runTest ./fanout.nix; fcitx5 = runTest ./fcitx5; fedimintd = runTest ./fedimintd.nix; - fenics = runTest ./fenics.nix; ferm = runTest ./ferm.nix; ferretdb = import ./ferretdb.nix { inherit pkgs runTest; }; fider = runTest ./fider.nix; diff --git a/nixos/tests/fenics.nix b/nixos/tests/fenics.nix deleted file mode 100644 index ebfff402627f..000000000000 --- a/nixos/tests/fenics.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ pkgs, ... }: - -let - fenicsScript = pkgs.writeScript "poisson.py" '' - #!/usr/bin/env python - from dolfin import * - - mesh = UnitSquareMesh(4, 4) - V = FunctionSpace(mesh, "Lagrange", 1) - - def boundary(x): - return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS - - u0 = Constant(0.0) - bc = DirichletBC(V, u0, boundary) - - u = TrialFunction(V) - v = TestFunction(V) - f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2) - g = Expression("sin(5*x[0])", degree=2) - a = inner(grad(u), grad(v))*dx - L = f*v*dx + g*v*ds - - u = Function(V) - solve(a == L, u, bc) - print(u) - ''; -in -{ - name = "fenics"; - meta = { - maintainers = with pkgs.lib.maintainers; [ ]; - }; - - nodes = { - fenicsnode = - { pkgs, ... }: - { - environment.systemPackages = with pkgs; [ - gcc - (python3.withPackages (ps: with ps; [ fenics ])) - ]; - }; - }; - testScript = - { nodes, ... }: - '' - start_all() - fenicsnode.succeed("${fenicsScript}") - ''; -} diff --git a/pkgs/development/python-modules/fenics/default.nix b/pkgs/development/python-modules/fenics/default.nix deleted file mode 100644 index a7cea8773bb8..000000000000 --- a/pkgs/development/python-modules/fenics/default.nix +++ /dev/null @@ -1,311 +0,0 @@ -{ - lib, - stdenv, - fetchurl, - fetchpatch, - blas, - boost186, - buildPythonPackage, - cmake, - doxygen, - eigen, - hdf5, - isPy27, - lapack, - mpi, - mpi4py, - numpy, - pkg-config, - pkgconfig, - ply, - pybind11, - pytest, - python, - scotch, - setuptools, - six, - sphinx, - suitesparse, - swig, - sympy, - zlib, - nixosTests, -}: - -let - version = "2019.1.0"; - - dijitso = buildPythonPackage { - pname = "dijitso"; - inherit version; - format = "setuptools"; - src = fetchurl { - url = "https://bitbucket.org/fenics-project/dijitso/downloads/dijitso-${version}.tar.gz"; - sha256 = "1ncgbr0bn5cvv16f13g722a0ipw6p9y6p4iasxjziwsp8kn5x97a"; - }; - propagatedBuildInputs = [ - numpy - six - ]; - nativeCheckInputs = [ pytest ]; - preCheck = '' - export HOME=$PWD - ''; - checkPhase = '' - runHook preCheck - py.test test/ - runHook postCheck - ''; - meta = { - description = "Distributed just-in-time shared library building"; - homepage = "https://fenicsproject.org/"; - platforms = lib.platforms.all; - license = lib.licenses.lgpl3; - }; - }; - - fiat = buildPythonPackage { - pname = "fiat"; - inherit version; - format = "setuptools"; - src = fetchurl { - url = "https://bitbucket.org/fenics-project/fiat/downloads/fiat-${version}.tar.gz"; - sha256 = "1sbi0fbr7w9g9ajr565g3njxrc3qydqjy3334vmz5xg0rd3106il"; - }; - propagatedBuildInputs = [ - numpy - six - sympy - ]; - nativeCheckInputs = [ pytest ]; - - preCheck = '' - # Workaround pytest 4.6.3 issue. - # See: https://bitbucket.org/fenics-project/fiat/pull-requests/59 - rm test/unit/test_quadrature.py - rm test/unit/test_reference_element.py - rm test/unit/test_fiat.py - - # Fix `np.float` deprecation in Numpy 1.20 - grep -lr 'np.float(' test/ | while read -r fn; do - substituteInPlace "$fn" \ - --replace "np.float(" "np.float64(" - done - ''; - checkPhase = '' - runHook preCheck - py.test test/unit/ - runHook postCheck - ''; - meta = { - description = "Automatic generation of finite element basis functions"; - homepage = "https://fenicsproject.org/"; - platforms = lib.platforms.all; - license = lib.licenses.lgpl3; - }; - }; - - ufl = buildPythonPackage { - pname = "ufl"; - inherit version; - format = "setuptools"; - src = fetchurl { - url = "https://bitbucket.org/fenics-project/ufl/downloads/ufl-${version}.tar.gz"; - sha256 = "04daxwg4y9c51sdgvwgmlc82nn0fjw7i2vzs15ckdc7dlazmcfi1"; - }; - propagatedBuildInputs = [ - numpy - six - ]; - nativeCheckInputs = [ pytest ]; - checkPhase = '' - runHook preCheck - py.test test/ - runHook postCheck - ''; - meta = { - description = "Domain-specific language for finite element variational forms"; - homepage = "https://fenicsproject.org/"; - platforms = lib.platforms.all; - license = lib.licenses.lgpl3; - }; - }; - - ffc = buildPythonPackage { - pname = "ffc"; - inherit version; - format = "setuptools"; - src = fetchurl { - url = "https://bitbucket.org/fenics-project/ffc/downloads/ffc-${version}.tar.gz"; - sha256 = "1zdg6pziss4va74pd7jjl8sc3ya2gmhpypccmyd8p7c66ji23y2g"; - }; - patches = [ - (fetchpatch { - name = "fenics-ffc-numpy2-compat.patch"; - url = "https://bitbucket.org/fenics-project/ffc/commits/245d15115b35b5ac091251fe6c84cc6474704b3c/raw"; - hash = "sha256-TcLQZ44C+uR2ryxtCBjR/5Tjn7B0S4MqoYi0nlP8JwI="; - }) - ]; - nativeBuildInputs = [ pybind11 ]; - propagatedBuildInputs = [ - dijitso - fiat - numpy - six - sympy - ufl - setuptools - ]; - nativeCheckInputs = [ pytest ]; - preCheck = '' - export HOME=$PWD - rm test/unit/ufc/finite_element/test_evaluate.py - ''; - checkPhase = '' - runHook preCheck - py.test test/unit/ - runHook postCheck - ''; - meta = { - description = "Compiler for finite element variational forms"; - homepage = "https://fenicsproject.org/"; - platforms = lib.platforms.all; - license = lib.licenses.lgpl3; - }; - }; - dolfin = stdenv.mkDerivation { - pname = "dolfin"; - inherit version; - src = fetchurl { - url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz"; - sha256 = "0kbyi4x5f6j4zpasch0swh0ch81w2h92rqm1nfp3ydi4a93vky33"; - }; - patches = [ - (fetchpatch { - name = "fix-double-prefix.patch"; - url = "https://bitbucket.org/josef_kemetmueller/dolfin/commits/328e94acd426ebaf2243c072b806be3379fd4340/raw"; - sha256 = "1zj7k3y7vsx0hz3gwwlxhq6gdqamqpcw90d4ishwx5ps5ckcsb9r"; - }) - (fetchpatch { - url = "https://bitbucket.org/fenics-project/dolfin/issues/attachments/1116/fenics-project/dolfin/1602778118.04/1116/0001-Use-__BYTE_ORDER__-instead-of-removed-Boost-endian.h.patch"; - hash = "sha256-wPaDmPU+jaD3ce3nNEbvM5p8e3zBdLozamLTJ/0ai2c="; - }) - (fetchpatch { - name = "fenics-boost-filesystem-1.85-compat.patch."; - url = "https://bitbucket.org/sblauth/dolfin/commits/16fa03887b3e9ec417c484ddf92db104cb9a93f9/raw"; - hash = "sha256-ZMKfzeWlPre88cKzrj04Tj+nQWS4ixat0bBvyt3TJmk="; - }) - ]; - # https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=dolfin&id=a965ad934f7b3d49a5e77fa6fb5e3c710ec2163e - postPatch = '' - sed -i '20 a #include ' dolfin/geometry/IntersectionConstruction.cpp - sed -i '26 a #include ' dolfin/mesh/MeshFunction.h - sed -i '25 a #include ' dolfin/mesh/MeshConnectivity.h - ''; - propagatedBuildInputs = [ - dijitso - fiat - numpy - six - ufl - ]; - nativeBuildInputs = [ - cmake - doxygen - pkg-config - ]; - buildInputs = [ - boost186 - dijitso - eigen - ffc - fiat - hdf5 - mpi - numpy - blas - lapack - ply - python - scotch - six - sphinx - suitesparse - swig - sympy - ufl - zlib - ]; - cmakeFlags = [ - "-DDOLFIN_CXX_FLAGS=-std=c++11" - "-DDOLFIN_AUTO_DETECT_MPI=ON" - "-DDOLFIN_ENABLE_CHOLMOD=ON" - "-DDOLFIN_ENABLE_DOCS=ON" - "-DDOLFIN_ENABLE_HDF5=ON" - "-DDOLFIN_ENABLE_MPI=ON" - "-DDOLFIN_ENABLE_SCOTCH=ON" - "-DDOLFIN_ENABLE_UMFPACK=ON" - "-DDOLFIN_ENABLE_ZLIB=ON" - "-DDOLFIN_SKIP_BUILD_TESTS=ON" # Otherwise SCOTCH is not found - # TODO: Enable the following features - "-DDOLFIN_ENABLE_PARMETIS=OFF" - "-DDOLFIN_ENABLE_PETSC=OFF" - "-DDOLFIN_ENABLE_SLEPC=OFF" - "-DDOLFIN_ENABLE_TRILINOS=OFF" - ]; - installCheckPhase = '' - source $out/share/dolfin/dolfin.conf - make runtests - ''; - meta = { - description = "FEniCS Problem Solving Environment in Python and C++"; - homepage = "https://fenicsproject.org/"; - license = lib.licenses.lgpl3; - }; - }; - python-dolfin = buildPythonPackage rec { - pname = "dolfin"; - inherit version; - format = "setuptools"; - disabled = isPy27; - src = dolfin.src; - sourceRoot = "${pname}-${version}/python"; - nativeBuildInputs = [ - pybind11 - cmake - ]; - dontUseCmakeConfigure = true; - preConfigure = '' - export CMAKE_PREFIX_PATH=${pybind11}/share/cmake/pybind11:$CMAKE_PREFIX_PATH - substituteInPlace setup.py --replace "pybind11==2.2.4" "pybind11" - substituteInPlace dolfin/jit/jit.py \ - --replace 'pkgconfig.exists("dolfin")' 'pkgconfig.exists("${dolfin}/lib/pkgconfig/dolfin.pc")' \ - --replace 'pkgconfig.parse("dolfin")' 'pkgconfig.parse("${dolfin}/lib/pkgconfig/dolfin.pc")' - ''; - buildInputs = [ - dolfin - boost186 - ]; - - propagatedBuildInputs = [ - dijitso - ffc - mpi4py - numpy - ufl - pkgconfig - pybind11 - ]; - doCheck = false; # Tries to orte_ess_init and call ssh to localhost - passthru.tests = { - inherit (nixosTests) fenics; - }; - meta = { - description = "Python bindings for the DOLFIN FEM compiler"; - homepage = "https://fenicsproject.org/"; - platforms = lib.platforms.all; - license = lib.licenses.lgpl3; - }; - }; -in -python-dolfin diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index 759d13f186ff..7fef795e025d 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -253,6 +253,7 @@ mapAliases ({ fastpair = throw "fastpair is unmaintained upstream and has therefore been removed"; # added 2024-05-01 faulthandler = throw "faulthandler is built into ${python.executable}"; # added 2021-07-12 inherit (super.pkgs) fetchPypi; # added 2023-05-25 + fenics = throw "fenics has been removed, use fenics-dolfinx instead"; # added 2025-08-07 filebrowser_safe = filebrowser-safe; # added 2024-01-03 filemagic = throw "inactive since 2014, so use python-magic instead"; # added 2022-11-19 flaskbabel = flask-babel; # added 2023-01-19 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index fc147660992c..ba73dbe06e6c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5053,8 +5053,6 @@ self: super: with self; { feedparser = callPackage ../development/python-modules/feedparser { }; - fenics = callPackage ../development/python-modules/fenics { hdf5 = pkgs.hdf5_1_10; }; - fenics-basix = callPackage ../development/python-modules/fenics-basix { }; fenics-dolfinx = callPackage ../development/python-modules/fenics-dolfinx { };