Repository: yaqwsx/KiKit

Issue #706: numpy 2.0 breaks KiKit, `numpy.lib.utils` has turned into an internal implementation detail
Created: 2024-06-28T04:27:23Z
Prerequisites

 I have read FAQ
 I have searched existing issues (including closed ones)
 I use KiKit at least version 1.5.1 (older version are not supported)

KiKit version
1.5.1+28.ga8a1405
KiCAD version
8.0.3
Operating system
Arch Linux
Description
When trying to use KiKit on a system that has numpy 2.0.0, it will fail to load due to numpy.lib.utils being turned into a private implementation detail, having been renamed numpy.lib._utils_impl. (see  numpy/numpy @ ace4445)
This causes the panelization section to fail to load taking down the rest of KiCad
Steps to Reproduce
$ python -m venv --system-site-packages .venv
$ source .venv/bin/activate
$ pip install numpy==2.0 kikit
$ python -c 'from kikit.actionPlugins import importAllPlugins; importAllPlugins()'

This will throw ModuleNotFoundError: No module named 'numpy.lib.utils' from kikit/actionPlugins/panelize.py when attempted.

Duplicate issue #721: KiKit CLI Crashes (compatibiltiy issues)
Created: 2024-07-29T08:15:38Z
Prerequisites

 I have read FAQ
 I have searched existing issues (including closed ones)
 I use KiKit at least version 1.5.1 (older version are not supported)

KiKit version
latest (output cannot be posted due to crash)
KiCAD version
8.0.4
Operating system
Windows
Description
When running the commend, i get the following error output:
===================
C:\Users\mchhe\OneDrive\Dokumente\git\zn0_bms_v2\pcb\v0.3\fab>kikit fab jlcpcb --no-drc --assembly --schematic ../zn0_bms.kicad_sch ../zn0_bms.kicad_pcb gerber_single/
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last):  File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\Scripts\kikit.exe_main.py", line 4, in 
from kikit.ui import cli
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\ui.py", line 2, in 
from kikit import (panelize_ui, export_ui, present_ui, stencil_ui,
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\panelize_ui.py", line 7, in 
from kikit.panelize_ui_sections import *
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\panelize_ui_sections.py", line 4, in 
from kikit import plugin
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\plugin.py", line 10, in 
from kikit.panelize import Panel
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\panelize.py", line 6, in 
from kikit.common import normalize
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\common.py", line 13, in 
from shapely.geometry import LinearRing
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\shapely_init.py", line 13, in 
from shapely.lib import GEOSException  # NOQA
AttributeError: _ARRAY_API not found
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\Scripts\kikit.exe_main.py", line 4, in 
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\ui.py", line 2, in 
from kikit import (panelize_ui, export_ui, present_ui, stencil_ui,
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\panelize_ui.py", line 7, in 
from kikit.panelize_ui_sections import *
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\panelize_ui_sections.py", line 4, in 
from kikit import plugin
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\plugin.py", line 10, in 
from kikit.panelize import Panel
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\panelize.py", line 6, in 
from kikit.common import normalize
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\kikit\common.py", line 13, in 
from shapely.geometry import LinearRing
File "C:\Users\mchhe\OneDrive\Dokumente\KiCad\8.0\3rdparty\Python311\site-packages\shapely_init.py", line 13, in 
from shapely.lib import GEOSException  # NOQA
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: numpy.core.multiarray failed to import
Steps to Reproduce
Execute commend above!

Closing comment (2024-07-29T08:19:24Z): This is a duplicate of #706, #715, #720, and #717.
There is a packaging problem in KiCAD 8.0.4 that can put Python environment into an inconsistent state. The solution is to run: pip install --upgrade --force-reinstall kikit