Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

python module

Hi Matthias,

Half a year ago I used the standalone python module without problems but totally forgot how did I install it. Now I have made a new install (pip install klayout) and downloaded the klayout-bits-1.0 and modified the PATH as per instructions in

import klayout.db

gives me

ERROR: Unable to load plugin: D:\ANACONDA3\lib\site-packages\klayout\db_plugins_lefdef_dbpi.cp36-win_amd64.dll with error message: 127 ERROR: Unable to load plugin: D:\ANACONDA3\lib\site-packages\klayout\db_plugins_pcb_dbpi.cp36-win_amd64.dll with error message: 127

and the popup says that dll entry cannot be located.

I guess I am missing something trivial - could you help me?

Thank you.



  • Installing klayout-0.26.0.dev8-cp36-cp36m-win_amd64.whl instead of
    solved the problem!
    However, when I try to use pyinstaller, and run the resulting .exe I get:

    RuntimeError: Unknown stream format: GDS2 in Layout.write


  • HI mikhails,

    dev8 is too old. It lacks some files that's why the GDS reader can't be found.

    You can dry to install dev16 and delete the "db_plugins_pcb_dbpi.cp36-win_amd64.dll" if you don't need support for PCB formats (Gerber).

    I'll try to reproduce the issue. But Windows is a pain.


  • Thanks, Matthias!

    Another related question if I may. I have a python macro, converting a custom polygon format to GDS. If I run it as

    Measure-Command {klayout_app.exe -z -r -rd infile=test.poly -rd outfile=test.gds}

    TotalSeconds : 0.0066875

    Now, I change it to use standalone python module (basically, only imports are changed from "import pya" to "import klayout.db as db" and run as

    Measure-Command {python test.poly test.gds}

    TotalSeconds : 1.196693

    Computed results are correct in both cases.
    Why this enormous difference? I hoped for the opposite...

    I am using Anaconda Python 3.6 on Windows 10.

  • Hi mikhails,

    I don't think the 6ms are correct in the first case. "klayout_app" is a big binary. It will load many shared objects and loading it should take much more than 6ms. On the other hand, "import klayout" pretty much does the same - at least for some shared objects. I observed long times for "import klayout.db" too. Depending on the system, some shared objects may be cached, so load times may vary.

    But essentially, the times you measure seem to be related to interpreter initialization, not execution time of your application.


  • Hello Matthias,
    Congrats for the great python module - it works awesome inside anaconda !
    I'm on the way too finalize now a larger project for Mask Generation and WaferMap optimization. I use the python standalone module to run all the different steps and the normal layout GUI to run some verification and optimization steps. Looking forward to see the further development.

    Best Regards,

  • Hi Andy,

    Thanks a lot this feedback! I really appreciate this!

    Kind regards,


  • Hi Matthias ,

    I got a similar problem with mikhails when packing my python file using Pyinstaller.
    It shows:
    " RuntimeError: Cannot determine format from filename in Layout.write"
    Is there any suggestion?

    I am using Python 3.6.8 on Windows 10.,


  • Hi,

    I think this is a different issue. What's the filename you give to Layout.write? It needs to be "gds2", "oas", "cif" or similar to be recognizable.

    If you want a specific format, use a "SaveLayoutOptions" object and specify a format. Then pass this object to "write".


Sign In or Register to comment.