Skip to content

Numpy incompatibility issues #69

Description

@scottbarnesg

There seems to be a compatibility issue between numpy dependencies in the picamera2 and opencv packages. When installing the streamer on a raspberry pi, I get the following error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
opencv-python-headless 4.12.0.88 requires numpy<2.3.0,>=2; python_version >= "3.9", but you have numpy 1.24.2 which is incompatible.

However, if I upgrade numpy, I get a different error when running streamer.py:

Traceback (most recent call last):
  File "/home/scottgbarnes/smart-sec-cam/backend/smart_sec_cam/streamer/streamer.py", line 71, in <module>
    streamer = Streamer(args.redis_url,
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scottgbarnes/smart-sec-cam/backend/smart_sec_cam/streamer/streamer.py", line 20, in __init__
    self.camera = RPiCamera(image_rotation=image_rotation)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scottgbarnes/smart-sec-cam/backend/smart_sec_cam/streamer/camera.py", line 46, in __init__
    from picamera2 import Picamera2 # Only import picamera at runtime, since it won't install on other systems
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/picamera2/__init__.py", line 11, in <module>
    from .picamera2 import Picamera2, Preview
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 30, in <module>
    from picamera2.encoders import Encoder, H264Encoder, MJPEGEncoder, Quality
  File "/usr/lib/python3/dist-packages/picamera2/encoders/__init__.py", line 5, in <module>
    from .encoder import Encoder, Quality
  File "/usr/lib/python3/dist-packages/picamera2/encoders/encoder.py", line 12, in <module>
    from ..request import _MappedBuffer
  File "/usr/lib/python3/dist-packages/picamera2/request.py", line 13, in <module>
    import simplejpeg
  File "/usr/lib/python3/dist-packages/simplejpeg/__init__.py", line 1, in <module>
    from ._jpeg import encode_jpeg, encode_jpeg_yuv_planes
  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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions