Instructions how to install the CSXCAD & openEMS python interface.

Module requirements

Some python modules are required to run openEMS simulations and tutorials: numpy, h5py, matplotlib

pip install numpy h5py matplotlib

Additionally Cython is required to compile CSXCAD and openEMS e.g. on Linux.

pip install cython


Build Modules Automatically

  • Build or update CSXCAD and openEMS using the “–python” flag (Recommended). See Install from Source for more details.

./ ~/opt/openEMS --python

Build Modules From Source Manually

  • Alternative: Manual build and install (if installed to /usr/local):

python install
cd ..

cd openEMS
python install
cd ..
  • Extended options, e.g. for custom install path at /opt:

python build_ext -I/opt/include -L/opt/lib -R/opt/lib"
pyhton install

Note: The install command may require root on Linux, or add --user to install to ~/.local


The python interface for CSXCAD & openEMS requires a build with a MS Visual Compiler. Download the latest windows build with the “msvc” label: openEMS_win

Install Pre-build Modules

For some python versions, pre-build wheel files can be found in the python sub-directory. E.g. for python 3.10 (using pip):

cd C:\opt\openEMS\python
pip install CSXCAD-0.6.2-cp310-cp310-win_amd64.whl
pip install openEMS-0.0.33-cp310-cp310-win_amd64.whl

Build Modules From Source

Download the sources using git. Assuming the MSVC binary build of openEMS is install at “C:\opt\openEMS”, run from a working python command prompt (e.g. using WinPython):

git clone --recursive
cd openEMS-Project/CSXCAD/python
python build_ext -IC:\opt\openEMS\include -LC:\opt\openEMS
python install

cd ../../openEMS/python
python build_ext -IC:\opt\openEMS\include -LC:\opt\openEMS
python install


Important Note: Python needs to find the dependent libraries (dll’s) during module import. To allow this, it is necessary to set an environment variable (permantently, terminal restart my be necessary):