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 5

    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.

Sign In or Register to comment.