A lightweight, flexible Python library for topology optimization built on top of Scikit Libraries
To contribute to the open-source community and education—which I’ve always benefited from—I decided to start this project.
The currently supported features are as follows:
- Coding with Python
- easy installation with pip/poetry
- Implement FEA on unstructured mesh using scikit-fem
- Structural Analysis / Heat Conduction Analysis
- Topology optimization using the density method and its optimization algorithm
- Optimality Criteria (OC) Method
- (Log-Space) Modified OC Method
- able to handle multiple force condition
- High-performance computation using sparse matrices with Scipy and PyAMG
- has a function to monitor the transition of parameters.
You can install Scikit-Topt either via pip or Poetry.
Scikit-Topt supports Python 3.10–3.13:
- 3.10–3.12 — fully supported and tested
- 3.13 — core topology optimization works normally,
but VTK-based features (VTU export & image rendering using PyVista)
are temporarily unavailable because VTK/PyVista do not yet provide wheels
for Python 3.13.
You can still run the full optimization workflow on Python 3.13;
only visualization-related features are restricted.
Choose one of the following methods:
pip install scikit-toptWith PETSc support:
pip install "scikit-topt[petsc4py]"The legacy alias below is also available:
pip install "scikit-topt[petsc]"poetry add scikit-toptWith PETSc support:
poetry add scikit-topt -E petsc4pypetsc4py requires a working PETSc installation. If PETSc is not already
available on your system, install PETSc first and then install the extra above.
The petsc4py extra installs the Python bindings only. At runtime, PETSc shared
libraries must also be discoverable by your Python environment.
Common environment variables are:
PETSC_DIR: PETSc installation rootPETSC_ARCH: PETSc build architecture nameLD_LIBRARY_PATH: shared-library search path on Linux
Typical Linux example:
export PETSC_DIR=/path/to/petsc
export PETSC_ARCH=arch-linux-c-opt
export LD_LIBRARY_PATH="$PETSC_DIR/$PETSC_ARCH/lib:$LD_LIBRARY_PATH"If PETSc was installed by a package manager or a preconfigured HPC module, these variables may already be set for you. In that case, no extra manual setup is needed.
You can validate the runtime with:
python -c "from petsc4py import PETSc; print(PETSc.Sys.getVersion())"If Scikit-Topt cannot load PETSc, first check that:
petsc4pyimports successfully- the PETSc shared libraries are visible in your library search path
PETSC_DIRandPETSC_ARCHpoint to the same PETSc build used forpetsc4py
If you want to visualize the optimized density distribution with mesh as an image, you need to enable off-screen rendering using a virtual display.
On Debian/Ubuntu:
sudo apt install xvfb libgl1-mesa-glxCentOS / RHL
sudo yum install xvfb libgl1-mesa-glxSee examples in example directory and README.md. README for Usage Examples
Optimization Algorithms and Techniques are briefly summarized here.
Optimization Algorithms and Techniques
We are happy to welcome any contributions to the library. You can contribute in various ways:
- Reporting bugs, opening pull requests, or starting discussions via GitHub Issues
- Writing new examples
- Improving the tests
- Enhancing the documentation or code readability doc
By contributing code to Scikit-Topt, you agree to release it under the Apache 2.0 License.
This software does not exist in a vacuum. Scikit-Topt is standing on the shoulders of proverbial giants. In particular, I want to thank the following projects for constituting the technical backbone of the project:
- Scipy
- Scikit-fem
- PyAMG
- Numba
- MeshIO
- Matplotlib
- PyVista
- Topology Optimization Community
If you use Scikit Topt in your research or software, please cite it as:
@article{Watanabe_Scikit-Topt_A_Python_2025,
author = {Watanabe, Kohei},
doi = {10.21105/joss.09092},
journal = {Journal of Open Source Software},
number = {116},
title = {{Scikit-Topt: A Python Library for Algorithm Development in Topology Optimization}},
volume = {10},
year = {2025}
}- Set break point from the optimization loop
- Add A feature to assign tags to nodes and cells
- Add Level Set
- Add other optimizers
- Evolutionary Algorithms
- MMA
- Add Multiple BC Conditions
- Add Unit Test






