[Python] Installing/Compiling wxPython for Python 3.13t (free threaded)

Discussão em 'Python' iniciado por Stack, Fevereiro 19, 2025.

  1. Stack

    Stack Membro Participativo

    I want to use wxPython under free threaded Python 3.13. Currently, there is no wheel file available.

    Problem 1: Pip will build from source but fail due to missing packages.

    Solution 1: I installed wheel, setuptools, six - and all packages listed in \requirements\install.txt and \dev.txt (located in the source tar-ball of wxPython). I already had Visual Studio 2019 installed, so I did not need to install C++ build tools.

    Problem 2: While the core libraries compile, 0pip fails at the first extension library (nano-svg).

    Solution 2: NONE. The problem originates from the Cython (?) file and is tied to __pyx_vectorcallfunc.

    [1/1] Cythonizing wx/svg\_nanosvg.pyx
    running build_ext
    building 'wx.svg._nanosvg' extension
    creating build\wxsvg\temp.win-amd64-cpython-313t\Release\wx\svg
    "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DNANOSVG_IMPLEMENTATION=1 -DNANOSVGRAST_IMPLEMENTATION=1 -DNANOSVG_ALL_COLOR_KEYWORDS=1 -DPy_GIL_DISABLED=1 -Iext/nanosvg/src -ID:\Python\pyBuildTest\include "-IC:\Program Files\Python\include" "-IC:\Program Files\Python\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\Include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" /Tcwx/svg\_nanosvg.c /Fobuild/wxsvg\temp.win-amd64-cpython-313t\Release\wx\svg\_nanosvg.obj
    _nanosvg.c
    ext/nanosvg/src\nanosvg.h(1450): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
    ext/nanosvg/src\nanosvg.h(1458): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
    ext/nanosvg/src\nanosvg.h(1491): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
    ext/nanosvg/src\nanosvg.h(1770): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
    ext/nanosvg/src\nanosvg.h(1791): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
    ext/nanosvg/src\nanosvg.h(2553): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
    ext/nanosvg/src\nanosvg.h(2557): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
    ext/nanosvg/src\nanosvg.h(2561): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
    ext/nanosvg/src\nanosvg.h(2565): warning C4244: '=': conversion from 'double' to 'float', possible loss of data
    wx/svg\_nanosvg.c(2455): error C2146: syntax error: missing ')' before identifier 'vc'
    wx/svg\_nanosvg.c(2455): error C2081: '__pyx_vectorcallfunc': name in formal parameter list illegal
    wx/svg\_nanosvg.c(2455): error C2061: syntax error: identifier 'vc'
    wx/svg\_nanosvg.c(2455): error C2059: syntax error: ';'
    wx/svg\_nanosvg.c(2455): error C2059: syntax error: ','
    wx/svg\_nanosvg.c(2455): error C2059: syntax error: ')'
    wx/svg\_nanosvg.c(25912): error C2146: syntax error: missing ')' before identifier 'vc'
    wx/svg\_nanosvg.c(25912): error C2081: '__pyx_vectorcallfunc': name in formal parameter list illegal
    wx/svg\_nanosvg.c(25912): error C2061: syntax error: identifier 'vc'
    wx/svg\_nanosvg.c(25912): error C2059: syntax error: ';'
    wx/svg\_nanosvg.c(25912): error C2059: syntax error: ','
    wx/svg\_nanosvg.c(25912): error C2059: syntax error: ')'
    wx/svg\_nanosvg.c(25957): error C2146: syntax error: missing ')' before identifier 'vc'
    wx/svg\_nanosvg.c(25957): error C2081: '__pyx_vectorcallfunc': name in formal parameter list illegal
    wx/svg\_nanosvg.c(25957): error C2061: syntax error: identifier 'vc'
    wx/svg\_nanosvg.c(25957): error C2059: syntax error: ';'
    wx/svg\_nanosvg.c(25957): error C2059: syntax error: ','
    wx/svg\_nanosvg.c(25957): error C2059: syntax error: ')'
    wx/svg\_nanosvg.c(26646): error C2065: '__pyx_vectorcallfunc': undeclared identifier
    wx/svg\_nanosvg.c(26646): error C2146: syntax error: missing ';' before identifier 'vc'
    wx/svg\_nanosvg.c(26646): error C2065: 'vc': undeclared identifier
    wx/svg\_nanosvg.c(26646): warning C4047: '=': 'int' differs in levels of indirection from 'vectorcallfunc'
    wx/svg\_nanosvg.c(26647): error C2065: 'vc': undeclared identifier
    wx/svg\_nanosvg.c(26649): warning C4013: '__Pyx_PyVectorcall_FastCallDict' undefined; assuming extern returning int
    wx/svg\_nanosvg.c(26649): error C2065: 'vc': undeclared identifier
    wx/svg\_nanosvg.c(26649): warning C4047: 'return': 'PyObject *' differs in levels of indirection from 'int'
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x64\\cl.exe' failed with exit code 2
    Command 'D:\Python\pyBuildTest\Scripts\python.exe setup-wxsvg.py build_ext --inplace' failed with exit code 1.
    Finished command: build_others (0m2.712s)
    Finished command: build_py (7m37.163s)
    Finished command: build (12m45.794s)
    Command '"D:\Python\pyBuildTest\Scripts\python.exe" -u build.py build' failed with exit code 1.

    My findings so far (no working solution)

    1. __pyx_vectorcallfunc is not recognized. This might be related to compatibility issue of Cython with three threading 3.13.
    2. A similar problem was posted in gits of other packages like scipy, linking the problem with __pyx_vectorcallfunc to an outdated Cython package.
    3. wxPython requires Cython 3.0.10, while the current (stable) version is 3.0.12. I upgraded to Cython version 3.0.12, and then to the alpha 3.1.x (built from git master) but the source build of wxPython still fails due to __pyx_vectorcallfunc.

    Has someone built wxPython (the wheel) from source successfully in free threading Python 3.13t?

    Should I address the wxPython team/git with this issue? Or should I just wait?

    Is there another workaround that allows me to build wxPython on 3.13t?

    EDIT: Had to rephrase, should hopefully be clearer now.

    Continue reading...

Compartilhe esta Página