Describe the bug
python-picamera2 does not import when using numpy 2.x
To Reproduce
Ensure latest picamera2 python system package is installed as well as numpy 1.26.4 or older (1.24.2 seems to be the system package version)
Upgrade numpy to latest 2.x (and scipy, requires newer)
$ pip install numpy==2.0.1 scipy==1.14.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting numpy==2.0.1
Using cached numpy-2.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (13.9 MB)
Collecting scipy==1.14.0
Using cached scipy-1.14.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (35.6 MB)
Successfully installed numpy-2.0.1 scipy-1.14.0
Import picamera2 and see that it fails
$ python3 -c 'from picamera2 import Picamera2' && echo $?
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/picamera2/__init__.py", line 9, in <module>
from .picamera2 import Picamera2, Preview
File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 27, in <module>
from picamera2.encoders import Encoder, H264Encoder, MJPEGEncoder, Quality
File "/usr/lib/python3/dist-packages/picamera2/encoders/__init__.py", line 6, in <module>
from .jpeg_encoder import JpegEncoder
File "/usr/lib/python3/dist-packages/picamera2/encoders/jpeg_encoder.py", line 3, in <module>
import simplejpeg
File "/usr/lib/python3/dist-packages/simplejpeg/__init__.py", line 1, in <module>
from ._jpeg import encode_jpeg
File "simplejpeg/_jpeg.pyx", line 1, in init simplejpeg._jpeg
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Expected behavior
Import should not fail with latest numpy
Console Output, Screenshots
See repro steps above
Hardware :
Model : Raspberry Pi 5 Model B Rev 1.0
Revision : d04170
Pi OS 64-bit
Linux rp-2ccf670e7060 6.6.31+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux
Describe the bug python-picamera2 does not import when using numpy 2.x
To Reproduce Ensure latest picamera2 python system package is installed as well as numpy 1.26.4 or older (1.24.2 seems to be the system package version)
Validate import works with numpy 1.x
Upgrade numpy to latest 2.x (and scipy, requires newer)
Import picamera2 and see that it fails
Expected behavior Import should not fail with latest numpy
Console Output, Screenshots See repro steps above
Hardware :