Registry / data / scikit-fem

scikit-fem

JSON →
library12.0.2pypypi✓ verified 85d ago

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.

pip install scikit-fem
INSTALL
IMPORT
SIG · SCIKIT-FEM
S
scikit-fem
datapythonv12.0.2
Install
7.5s avg
Import
1220ms
Disk
232MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v12.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.278s · 232.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 7.5s · import 1.162s · 224MB
232MB installed
● package 232MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Basis
from skfem import Basis
from skfem.basis import Basis
Basis is a top-level export, not in a submodule.
Mesh
from skfem import Mesh
from skfem.mesh import Mesh
Mesh is exported from the top-level package.
BilinearForm
from skfem import BilinearForm
from skfem.assembly import BilinearForm
BilinearForm is a top-level export.
asm
from skfem import asm
from skfem.assembly import asm
asm is a top-level function.
np
import numpy as np
scikit-fem relies heavily on numpy; always import numpy.

Assemble a simple 2D Poisson problem: -Δu = 1 on unit square with zero Dirichlet BCs (not applied).

import numpy as np from skfem import Mesh, Basis, BilinearForm, LinearForm, asm from skfem.helpers import dot, grad # Create a simple unit square mesh mesh = Mesh().refined(2) # Define basis for linear elements basis = Basis(mesh, ElementTriP1()) # Define bilinear form for Laplacian @BilinearForm def laplace(u, v, w): return dot(grad(u), grad(v)) # Assemble stiffness matrix A = asm(laplace, basis) # Define linear form for rhs @LinearForm def rhs(v, w): return 1.0 * v # Assemble rhs vector b = asm(rhs, basis) # Solve (requires scipy or similar) # x = np.linalg.solve(A, b) print(A.shape)
Debug
Known issues
breakingMesh.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+.
fix
Review Mesh.boundaries after call to with_defaults; adjust tolerance or explicitly tag facets if needed.
affects: >=12.0.0
deprecatedskfem.visuals.glvis has been deprecated in 9.0.0 and is broken; no replacement planned.
fix
Use alternative visualization like matplotlib or PyVista directly on mesh data.
affects: >=9.0.0
breakingMortarFacetBasis and MappingMortar removed in 9.0.0; use skfem.supermeshing instead.
fix
Replace imports from skfem.assembly.mortar with skfem.supermeshing.
affects: >=9.0.0
gotchaInitializing 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.
fix
Explicitly set intorder when using ElementTetP0 with Basis.
affects: >=10.0.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'skfem'
scikit-fem not installed or environment not activated.
fix
Run 'pip install scikit-fem' in your terminal.
AttributeError: module 'skfem' has no attribute 'ElementTriP1'
ElementTriP1 is in skfem.element module but often imported directly. The error may occur if using old import path.
fix
Use 'from skfem import ElementTriP1' or 'from skfem.element import ElementTriP1'.
TypeError: 'BilinearForm' object is not callable
Incorrect usage of BilinearForm decorator; likely calling the decorator incorrectly.
fix
Use '@BilinearForm' on a function that takes (u, v, w) and returns a scalar expression. Then pass to asm.
Upgrade
Version history
12.0.2latest on PyPI · released Jun 5, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
scikit-fem — pip install scikit-fem · libregistry