Issue starting Lumerical FDTD via Python API

johnrollinsonjohnrollinson Member Posts: 1


I am running into an issue where I can run FDTD simulations via the GUI, but I cannot run them via the Python API. If I try to run the following line:

fdtd = lumapi.FDTD(hide=False)

The execution will just hang indefinitely. If I kill the script, I get the following error output:

Traceback (most recent call last):

 File "/home/rhome/rollij2/lumerical/gf_grating_coupler/45spclo/", line 502, in <module>

  with lumapi.FDTD(hide=False) as fdtd:

 File "/opt/lumerical/v211/api/python/", line 1294, in __init__

  super(FDTD, self).__init__('fdtd', filename, key, hide, serverArgs, **kwargs)

 File "/opt/lumerical/v211/api/python/", line 1072, in __init__

  self.handle = open(product, key, hide, serverArgs)

 File "/opt/lumerical/v211/api/python/", line 231, in open

  h = iapi.appOpen(url, k)


Exception ignored in: <function Lumerical.__del__ at 0x7f84e04f6790>

Traceback (most recent call last):

 File "/opt/lumerical/v211/api/python/", line 1170, in __del__


AttributeError: 'FDTD' object has no attribute 'handle'

So it looks like it is getting stuck when it is trying to open an FDTD instance. This issue just started appearing today, seemingly out of nowhere. Any help in debugging or fixing the issue is greatly appreciated.


Best Answer


  • johnrollinsonjohnrollinson Posts: 6Member
    edited June 3

    Update: We updated our Lumerical installation and the issue is still persisting (previously we were using v2020 R2.4, I believe).

    Now, instead of getting stuck indefinitely, it is giving us an error (still at the same point in the code though):

    lumapi.LumApiError: 'appOpen error: \n Failed to start messaging, check licenses...'

    As far as I am aware, there have been no changes to our license. When we check the Ansys license manager log, we don't see any errors.

  • johnrollinsonjohnrollinson Posts: 6Member

    Another update: it seems like the issue only happens when I try to run Python scripts from a separate Python IDE. If I run the script from the Lumerical script file editor, this issue doesn't happen.

  • gsungsun Posts: 751Ansys Employee

    Lumerical API with Python works with built-in Python. So please uninstall your own version of Python.

  • johnrollinsonjohnrollinson Posts: 6Member
    edited June 3

    I have already configured my IDE to use the python interpreter provided by Lumerical:


    So I'm not sure that this is related to the version of Python

  • LitoLito Posts: 113Ansys Employee


    Our bundled Python cannot install additional modules in case your script is using one that is not included in our package. You can use your own Python3 installation and include the path for the Lumerical API/module in your environment. 




  • johnrollinsonjohnrollinson Posts: 6Member


    I have tried both way (using my own version of python and explicitly including the lumapi path, or just using the version of python provided by Lumerical) and I get the same error using both methods.

    The error output is from lumapi, so there I don't think there is any issue importing the module.

    The error output indicates that the script gets to the point of trying to open an FDTD instance (self.handle = open(product, key, hide, serverArgs)). For reasons which are unclear to me, this line is failing when I run a script outside of Lumerical (e.g. from either command line or from an IDE) but passes when I run it from the Lumerical GUI (from the script file editor).

    Just to be clear, in the past I have never had any issues running python scripts outside of the Lumerical GUI. This issue only started appearing this week, even though as far as I am aware, there have been no changes to my python environment.

  • LitoLito Posts: 113Ansys Employee


    Were you using a different older version before this issue happen? Or the currently installed version was working before and the issue just recently happened?

  • johnrollinsonjohnrollinson Posts: 6Member

    Previously I was using an older version (I believe it was either 2020 R2.4 or 2021 R1 but I can't remember). The issue then started while I was using the older version. We updated to the latest version hoping this might fix the issue, however it has not. The only thing which has changed after updating is the error that Python is reporting (presumably due to changes in the error handling for the updated the lumapi module). But the line at which the code is failing is still the same.

  • seekjim20seekjim20 Posts: 1Member

    We have the same problem with MODE SOLUTION (Version 2021), it reports

    "LumApiError: 'appOpen error: \n Failed to start messaging, check licenses...'" 

    We previously used 2019b and 2020a, and did not have this issue. It only came up when we upgraded to 2021.

    The MODE Solution window actually opens properly. It is just that it does not return the proper handle back to Python, and thus we can not continue from the Python script.

  • LitoLito Posts: 113Ansys Employee

    @seekjim20 ,

    Please configure Lumerical 2021 R1 to obtain the license from the correct License Manager. Either Lumerical (Standard) Or Ansys (Standard). Consult your IT/license server admin which license manager is running on the license server you are accessing.



Sign In or Register to comment.