Python interoperability error: issue with "import lumapi"


I’m trying to import Lumerical’s Python API and I’m facing the following issue:

I tried checking the Python interoperability through the GUI and it seems to be active:

Windows 10 64bit v1809 (build 17763.914)
Lumerical 2020a R2
Python 3.8.1

I’d appreciate any help with this!


Hi Man, you typed the syntax “import lumapi” in the wrong place. It should be in python IDE or the Lumerical script editor (.py).

Dear @quentinl

The picture above is from a Python terminal opened via command terminal. I tried using a typical Python IDE and it results in the same issue:


It is very convenient to use python provided by Lumerical.

If you like to use python installed from elsewhere, you may need to set the path correctly. Only set the path of python API is not enough.

Thanks for the recommendation @quentinl - unfortunately the Python version shipped with the package is limited in terms of the available packages, and pip doesn’t seem to be working with it.

Is it possible to use my own version of Python with my installed packages instead?

python, Numpy, Scipy, Matplotlib installed together with Lumerical products, in case they are downloaded from the homepage of Lumerical.

“.py” is integrated with Lumerical script file editor as showed in the screenshot. You can also find python.exe from the program files where you installed Lumerical products in your PC.

Thanks for the response @quentinl - typically one would use more packages needed for scripting other than these three. Is it not possible to integrate default Python to use lumapi?


Please check the introduction in followed link.

Follow up for those interested - to fix this issue, you also need to add the dll directories in the lumapi python path. Use the following:

os.add_dll_directory(“C:\Program Files\Lumerical\2020a\api\python”)

*replace 2020a with your version.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.