I’ve literally tried dozens of version builds (kicad versions, wxwidget versions, wxpython versions), and variations to solve this problem. apt variations, pip variations, virtualenv variations, library variations, pythonpath variations and a pypy3 build of wxpython. also building from source variations ive tried.
Regarding the code itself, I’m not a pro coder, so I haven’t gotten my hands dirty with the python code itself, and have only tried very small changes with no solution.
I have come to the conclusion that there are only two solutions.
Either you upgrade to python3.10, or you use wxpython 4.0 / wxwidgets 3.0 until the probelm is solved. I am so sick of waiting for the wheels to build lol.
edit:
I read one hopeful post somewhere about a non-kicad program having this same exact error, and the person solved it by building the wheel for wxpython using CONDA.
the thing is, I didnt see version 4.2 on the conda repo, only 4.1.1.
also, unfortunately, conda is no longer updated for aarch64 .
KiCad, python, wxwidgets and wxpython work when they are all built together against same version of system libs and each other. So best thing is to get rid of all of your manual shenanigans and
use packages provided by your OS. If that’s not possible then
use packages someone already built in a 3rd party repo. If those are not available then
use python, wxwidgets and wxpython provided by OS and build KiCad only. If that’s not possible then
Think hard on why you use an OS that has a broken package ecosystem. If switching to a more popular and maintained OS is not an option then
Use python provided by OS, remove any and all wxwidgets, wxpython from your system and build them from source (it’s necessary to match their versions correctly!), then build KiCad from source