I’m running Ubuntu 22.04.4, and I’ve installed Kicad 8 with:
sudo apt install --install-recommends kicad
Everything seems to be working great except when I try to open the python scripting console in PCBNew, I get the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/share/kicad/scripting/kicad_pyshell/__init__.py", line 23, in <module>
import pcbnew
ModuleNotFoundError: No module named 'pcbnew'
I’m not sure where pcbnew.py is supposed to live, but I don’t see it anywhere under /usr/share/kicad.
Does anyone have any suggestions for how I may try to fix this error, or if there’s more debug information I can provide?
I am unfamiliar with this document. But since you seem to know about the contents, I would recommend you submit a merge request with the appropriate changes.
O no, more breakage? This is the curse of morons maintaining python pushing sysconfig as a replacement for distutils (now removed in python 3.12) while splintering the api.
You will want to look here and figure at what additional else if case is needed, without breaking all the other platforms, lolololololol.
We already attempted to fix it once for Debian which is already in 8.0.1
I’m not expert in Debian packages, this is why I suggest borrowing more from the official Debian packages.
A couple of times I created Debian files to package KiCad, I always used the files derived from the Debian packages.
In this case I found the issue because a KiBot user failed to install it on Ubuntu 20.04 (on WSL). After asking the user to do a lot of tests I found that KiCad package is using a directory that isn’t in Python’s sys.path. And looking at other Ubuntu and Debian packages for KiCad isn’t the same.
I generate Python packages for KiBot (and other plugins), but I use debmake using the pybuild system. So I don’t mess much with the Python part, just let debmake do the job.
This change/breakage occurred to our cmake script needing to evolve for python 3.12 which removed distutils. cmake is now using sysconfig which thanks to Linux distros and the inepitude of python, sysconfig has branching implementations for finding the right path depending on your linux distro and os (yes linux distro itself is an additional variance). distutils had one very clear function and always returned the right path.
The Debian packages wouldn’t help here. It needs to be fixed in the cmake. Especially since the most recent Debian stable is still on 6.0 and backports on 7.0, lol.