PyAEDT
raw JSON → 0.26.3 verified Fri May 01 auth: no python
High-level Python API for automating Ansys Electronics Desktop (AEDT). Currently at version 0.26.3 with frequent releases (approximately monthly). Python >=3.10 required.
pip install pyaedt Common errors
error ModuleNotFoundError: No module named 'pyaedt.hfss' ↓
cause Import path changed in v0.26.0; 'pyaedt.hfss' is no longer a valid submodule.
fix
Use 'from pyaedt import Hfss' instead.
error OSError: AEDT not found. Check if AEDT is installed and the environment variable is set. ↓
cause PyAEDT cannot locate the AEDT installation.
fix
Set the environment variable ANSYSEM_ROOT2025.1 (use your version) to the AEDT installation folder, or use the 'specified_version' parameter with a valid version.
error TypeError: __init__() got an unexpected keyword argument 'desktop_class' ↓
cause The 'desktop_class' parameter was removed in v0.26.0.
fix
Replace 'desktop_class' with 'new_desktop'.
error Exception: PyAEDT is running in graphical mode. Use non-graphical mode to avoid display issues. ↓
cause Headless server without display support.
fix
Set PYAEDT_NON_GRAPHICAL=1 environment variable before running the script.
Warnings
deprecated Direct import of submodules like 'from pyaedt.hfss import Hfss' is deprecated. Use 'from pyaedt import Hfss'. ↓
fix Replace with 'from pyaedt import Hfss'.
breaking In v0.26.0, the 'desktop_class' parameter is replaced by 'new_desktop' and 'close_on_exit'. ↓
fix Use Hfss(new_desktop=True, close_on_exit=True) instead of Hfss(desktop_class=True).
gotcha PyAEDT requires AEDT to be installed and licensed. Errors like 'OSError: AEDT not found' occur if AEDT is not in the expected path. ↓
fix Ensure Ansys Electronics Desktop is installed and the version matches the specified_version. Set environment variable ANSYSEM_ROOT2025.1 to the install path.
gotcha Non-graphical mode must be used in CI/headless environments. Without it, AEDT may try to launch the GUI and fail. ↓
fix Set environment variable PYAEDT_NON_GRAPHICAL=1 before importing pyaedt.
Imports
- Hfss wrong
from pyaedt.hfss import Hfsscorrectfrom pyaedt import Hfss - Maxwell2d wrong
from pyaedt.maxwell import Maxwell2dcorrectfrom pyaedt import Maxwell2d
Quickstart
from pyaedt import Hfss
hfss = Hfss(specified_version="2025.1", new_desktop=True)
hfss.close_desktop()