locate_lumerical_install#

ansys.lumerical.core.autodiscovery.locate_lumerical_install()#

Locate the installation directory and interop library directory for Lumerical software.

This function attempts to identify the most recent installation path of Lumerical software and its associated Python interop library directory based on the operating system and predefined directory structures.

Returns:
str or None

The path to the Lumerical installation directory, or None if not found.

Raises:
RuntimeError

If the operating system is not Windows or Linux.

Notes

  • On Windows, the function first searches the registry, then searches under “C:\Program Files\Lumerical\” and “C:\Program Files\Ansys Inc\Lumerical”.

  • On Linux, the function searches under “/opt/lumerical/” and “~/Ansys/ansys_inc/Lumerical”.

Examples

Example 1: Use autodiscovery to locate a Lumerical installation in a default location.

>>> import ansys.lumerical.core as lumapi
>>> # use lumapi ...

Example 2: Provide a custom installation path before importing the module.

>>> import ansys.api.lumerical.lumapi
>>> ansys.api.lumerical.lumapi.InteropPaths.setLumericalInstallPath(r"C:\Program Files\Lumerical\v252\")
>>> import ansys.lumerical.core as lumapi
>>> # use lumapi ...

Example 3: Provide a custom installation path after importing the module.

>>> import ansys.lumerical.core as lumapi
Warning: Lumerical installation not found. Please use InteropPaths.setLumericalInstallPath to set the interop library location.
>>> lumapi.InteropPaths.setLumericalInstallPath(r"C:\Program Files\Lumerical\v252\")
>>> # use lumapi ...