{"id":22339,"library":"scikit-fem","title":"scikit-fem","description":"A simple finite element assembler library for Python. Current version 12.0.1, requires Python >=3.10. Released roughly every few months on GitHub. Provides a high-level interface for assembling finite element matrices and vectors, with support for various element types and mesh formats.","status":"active","version":"12.0.1","language":"python","source_language":"en","source_url":"https://github.com/kinnala/scikit-fem","tags":["finite-elements","fem","science","simulation","numerical-analysis"],"install":[{"cmd":"pip install scikit-fem","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Basis is a top-level export, not in a submodule.","wrong":"from skfem.basis import Basis","symbol":"Basis","correct":"from skfem import Basis"},{"note":"Mesh is exported from the top-level package.","wrong":"from skfem.mesh import Mesh","symbol":"Mesh","correct":"from skfem import Mesh"},{"note":"BilinearForm is a top-level export.","wrong":"from skfem.assembly import BilinearForm","symbol":"BilinearForm","correct":"from skfem import BilinearForm"},{"note":"asm is a top-level function.","wrong":"from skfem.assembly import asm","symbol":"asm","correct":"from skfem import asm"},{"note":"scikit-fem relies heavily on numpy; always import numpy.","wrong":null,"symbol":"np","correct":"import numpy as np"}],"quickstart":{"code":"import numpy as np\nfrom skfem import Mesh, Basis, BilinearForm, LinearForm, asm\nfrom skfem.helpers import dot, grad\n\n# Create a simple unit square mesh\nmesh = Mesh().refined(2)\n\n# Define basis for linear elements\nbasis = Basis(mesh, ElementTriP1())\n\n# Define bilinear form for Laplacian\n@BilinearForm\ndef laplace(u, v, w):\n    return dot(grad(u), grad(v))\n\n# Assemble stiffness matrix\nA = asm(laplace, basis)\n\n# Define linear form for rhs\n@LinearForm\ndef rhs(v, w):\n    return 1.0 * v\n\n# Assemble rhs vector\nb = asm(rhs, basis)\n\n# Solve (requires scipy or similar)\n# x = np.linalg.solve(A, b)\nprint(A.shape)","lang":"python","description":"Assemble a simple 2D Poisson problem: -Δu = 1 on unit square with zero Dirichlet BCs (not applied)."},"warnings":[{"fix":"Review Mesh.boundaries after call to with_defaults; adjust tolerance or explicitly tag facets if needed.","message":"Mesh.with_defaults now uses np.isclose for facet matching, which may cause previously unmatched facets to be tagged. Check your mesh boundary tags after upgrading to 12.0.0+.","severity":"breaking","affected_versions":">=12.0.0"},{"fix":"Use alternative visualization like matplotlib or PyVista directly on mesh data.","message":"skfem.visuals.glvis has been deprecated in 9.0.0 and is broken; no replacement planned.","severity":"deprecated","affected_versions":">=9.0.0"},{"fix":"Replace imports from skfem.assembly.mortar with skfem.supermeshing.","message":"MortarFacetBasis and MappingMortar removed in 9.0.0; use skfem.supermeshing instead.","severity":"breaking","affected_versions":">=9.0.0"},{"fix":"Explicitly set intorder when using ElementTetP0 with Basis.","message":"Initializing Basis for ElementTetP0 without intorder or quadrature will now automatically fall back to a one-point integration rule (since 10.0.0). This may affect accuracy.","severity":"gotcha","affected_versions":">=10.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'pip install scikit-fem' in your terminal.","cause":"scikit-fem not installed or environment not activated.","error":"ModuleNotFoundError: No module named 'skfem'"},{"fix":"Use 'from skfem import ElementTriP1' or 'from skfem.element import ElementTriP1'.","cause":"ElementTriP1 is in skfem.element module but often imported directly. The error may occur if using old import path.","error":"AttributeError: module 'skfem' has no attribute 'ElementTriP1'"},{"fix":"Use '@BilinearForm' on a function that takes (u, v, w) and returns a scalar expression. Then pass to asm.","cause":"Incorrect usage of BilinearForm decorator; likely calling the decorator incorrectly.","error":"TypeError: 'BilinearForm' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}