PyPI KLayout Module & Windows

Hi All:

I have been using the KLayout Python module a lot and see the following:

  • On RedHat EL 6 I can compile the "master" branch (0.26?) and get the module to work on a Python 3.6.7 install just by setting the $PYTHONPATH variable to include the .../pymod directory from the install directory.

  • On Windows 10 with Windows Subsystem for Linux I can install the .deb file for Ubuntu 16.04, and then I can run python3 on WSL with klayout (and Pycharm Professional Edition on the Windows side). Working well.

  • On MS Windows (outside of WSL), I can install the PyPI module (or the one from: http://www.klayout.org/downloads/pymod/) with "PowerShell" but then when I start the Python and import klayout I get:

    import klayout
    import klayout.db as kl

    Traceback (most recent call last):
    File "", line 1, in
    File "C:\Users\nxa11113\AppData\Local\Python36\lib\site-packages\klayout\db__init__.py", line 1, in
    import klayout.dbcore
    ImportError: DLL load failed: The specified module could not be found.

    >

I have Python 3.6.7 (from python.org, the 64-bit install) installed in:
C:\Users\nxa11113\AppData\Local\Python36

Does this module work for anyone, and if so, does Python need to be installed anywhere else? Also I have lots of other stuff installed and I can't exclude side effects.

Thanks for any suggestions.

Best regards, Erwin

Comments

  • Hi Erwin,

    Thanks for the feedback :-)

    Regarding Windows: did you install the 3rd party package?

    The Python module does not come with all the necessary 3rd party libraries such as pthread, zlib etc. Honestly, I don't know how to package them with setuptools (you). You can install them manually and let PATH point to them. The procedure is a bit clumsy currently, but I think it'll go away once the masters of setuptools will enlighten me (or I screw up and package all the 3rd party libs into an installer).

    You can find the details here: https://github.com/klayoutmatthias/klayout/wiki/KLayout-Python-Module#using-the-python-package-on-windows.

    Best regards,

    Matthias

  • Hi Matthias, thanks, I'll have a look at how setuptools work. Actually, my solution (WSL with Pycharm on Windows) has been working really well (because I can use the Python either on the Windows Subsystem for Linux side, or also the Python in our Linux farm if I want to tie in other tools) but it does require the commercial edition of PyCharm (not an issue for me). There is another solution which I haven't tried (again sidestepping the packaging challenge on Windows) which is to run the Ubuntu PyCharm on WSL with the
    https://sourceforge.net/projects/vcxsrv/
    server which everybody seems to be using, see
    https://seanthegeek.net/234/graphical-linux-applications-bash-ubuntu-windows/
    Let me have a look at your link, and happy holidays from Texas.
    Best regards, Erwin

  • Just to close this, I followed Matthias's instructions and now I have the Python module working with Python 3.6.7 on Windows (the canonical install from python.org). This is good, mainly because it makes it easy to share the module with others.

    Also, for some reason, PyCharm doesn't work well under WSL so if one wants to use WSL Python (with KLayout or some other way) it is better to run PyCharm under Windows and use an SSH connection to WSL. The same is true for running PyCharm on a server behind a VPN. So this is where the pro version of PyCharm is very useful.

  • Hi Erwin,

    good to hear .. thanks for sharing this. We're working on providing a pre-build Windows module.

    Best regards,

    Matthias

Sign In or Register to comment.