Some binaries are missing in self built python wheel

I built pythod wheel from git source (0.28) using Microsoft VS 2017 (and a few tools installed at MSYS2). But "python setup.py build" would not generate wheel file. So I built it by the following commands.

set PATH=c:\msys64\usr\bin;%PATH%
set "PATH=c:\Program Files\cmake\bin;%PATH%"
set "PATH=c:\strawberry\perl\bin;%PATH%"
set "PATH=C:\Users\ywko\AppData\Local\bin\NASM;%PATH%"
set "PATH=C:\Users\ywko\AppData\Local\Programs\Python\Python310\;%PATH%"
set "PATH=C:\Users\ywko\AppData\Local\Programs\Python\Python310\Scripts\;%PATH%"
set KLAYOUT_BITS=C:\klayout_bits4msvc2017-master\buildtemp\msvc2017\x64
python -m build

This generated a wheel and I can install it with pip command. But, "import klayout.db" results in "ImportError: DLL load failed while importing dbcore". After comparing it against PyPi version, I found binaries (such as libcurl.dll) from klayout_bits folders are missing. So, I copied those binaries to klayout installation folder. And it works well now.

Since this is the first time for me to build a wheel from source, maybe I did something wrong. What did I miss?

Comments

  • For building the wheel, you usually simply have to use

    python3 setup.py bdist_wheel
    

    But you will find wheels for Windows in the artefact section of the Azure CI pipeline for example here : https://dev.azure.com/klayout/klayout/_build/results?buildId=1451&view=artifacts&pathAsName=false&type=publishedArtifacts

    Matthias

  • Since I wanted to build python module with DXF reader plugin sources modified to suppress warning messages, I couldn't use existing distributions. Thanks to your suggested link, after checking Azure pipeline logs, I found how to fix built wheel. Now, I can fix wheel using fix_wheel.sh found under ci-scripts folder. Thanks a lot.

    And I found help message in fix_wheel.sh is a little misleading.

    echo -e "\nUsage:\n./${SCRIPT_NAME} [--help|-h] klayout-...-win_amd64.whl \n"
    

    could be improved like this

    echo -e "\nUsage:\n./${SCRIPT_NAME} [--help|-h] klayout-...-win_amd64.whl KLAYOUT_BITS_FOLDER \n"`
    
  • edited September 2022

    Maybe you do not need to build yourself ... I have merged this patch two days ago: https://github.com/KLayout/klayout/issues/1138

    So there is a way to suppress DXF (or in general) reader warnings now (0.28).

    Matthias

  • Good to know the added feature.
    But, wheels for Windows at Azure still do not seem to include the feature. A wheel built from git source downloaded today works as expected (warn_level = 0 suppresses all warning messages). Happy.

  • Hi Matthias, I wanted to ask about suppressing warnings in the python terminal output. I wrote a data collection python script that iterates through a list of separate .oas files and parses their data.

    Even with starting off my main method with:

    " import klayout.db as kl
    options = kl.LoadLayoutOptions()
    options.warn_level = 0 "

    I am getting "Warning: Type 0 or 1 point list with odd number of points is illegal (position=27938, cell=#0)" repeated over and over again each time I call layout.read() on my next file. Is there any way to suppress this output?

    Should I open a new thread on the forum for this? Thanks

  • edited January 24

    Yes, new thread please. This is entirely unrelated.

    But I'd take the warning serious. Maybe you can share a sample file that produces the warning, and I can help debugging. With sane OASIS files, no warnings should be seen.

    And maybe you can share the call to "layout.read()". I assume you're not passing the options object to the call. Otherwise the warnings should go away. But again, consider fixing your OASIS file. It is damaged.

    Matthias

  • "And maybe you can share the call to "layout.read()". I assume you're not passing the options object to the call. Otherwise the warnings should go away. But again, consider fixing your OASIS file. It is damaged."

    This was it -- thank you so much! I forgot to pass the options as an argument in the layout.read call. I will also look into what might be wrong with our OAS files.

    Best Regards,
    SWendell

Sign In or Register to comment.