pyTDGL logo.

pyTDGL requires python 3.8, 3.9, 3.10, or 3.11. We recommend creating a new conda environment for pyTDGL to avoid dependency conflicts with other packages. To create and activate a conda environment called tdgl, run:

conda create --name tdgl python="3.10"
conda activate tdgl

Install via pip

  • From PyPI, the Python Package index:

    pip install tdgl
  • From GitHub:

    pip install git+

Editable installation

To install an editable version of pyTDGL for development, run:

git clone
cd py-tdgl
pip install -e ".[dev,docs]"

Optional dependencies

tdgl supports multiple solvers for sparse systems of linear equations: SuperLU (the default), UMFPACK, and MKL PARDISO.

SuperLU, the default solver, is included in scipy and therefore requires no additional installation.

The other solvers, UMFPACK and PARDISO, may outperform SuperLU on certain problems and certain CPU hardware. In particular, PARDISO is optimized for Intel CPUs and, unlike SuperLU and UMFPACK, is multithreaded. This means that PARDISO may perform best when solving models with very large meshes on Intel CPUs.

Your mileage may vary, so we encourage you to try the different solvers if you are looking to optimize the run time of your tdgl simulations. The sparse solver can be specified by setting the sparse_solver attribute of tdgl.SolverOptions to one of {"superlu", "umfpack", "pardiso"}.

Installing UMFPACK

UMFPACK requires the SuiteSparse library, which can be installed using conda.

# After activating your conda environment for tdgl
conda install -c conda-forge suitesparse

pip install swig scikit-umfpack
# or pip install tdgl[umfpack]

Installing PARDISO


The MKL PARDISO solver can only be used with Intel CPUs.

tdgl supports the PyPardiso interface to the PARDISO solver. PyPardiso can be installed using either pip or conda.

# After activating your conda environment for tdgl
pip install pypardiso
# or conda install -c conda-forge pypardiso
# or pip install tdgl[pardiso]

Verify the installation

To verify your installation by running the tdgl test suite, execute the following command in a terminal:

python -m tdgl.testing

If you prefer, you can instead run the following commands in a Python session:

>>> import tdgl.testing