monkeymademe / picamera2-WebUI

This is a VERY basic WebUI for the Picamera2 Library for the Raspberry Pi
MIT License
83 stars 11 forks source link

RuntimeError: Failed to start camera: Cannot allocate memory #25

Closed Exper1mental closed 4 months ago

Exper1mental commented 4 months ago

Describe the bug When I run python app.py I am given the error: RuntimeError: Failed to start camera: Cannot allocate memory.

Here is the full output:

python app.py 
[1:11:58.421579735] [5828]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5
[1:11:58.459215937] [5841]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[1:11:58.462816783] [5841]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media1
[1:11:58.463588051] [5841]  INFO RPI pipeline_base.cpp:1144 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[1:11:58.468412550] [5828]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5
[1:11:58.502212389] [5844]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[1:11:58.506007159] [5844]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media1
[1:11:58.506750743] [5844]  INFO RPI pipeline_base.cpp:1144 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
{'controls': {'LensPosition': 1.0, 'ExposureValue': 0.0, 'ExposureTime': 220417486, 'AwbMode': 0, 'AfSpeed': 0, 'AfRange': 0, 'AeMeteringMode': 0, 'AeFlickerPeriod': 1000000, 'AeFlickerMode': 0, 'AeExposureMode': 0, 'AeEnable': True, 'AwbEnable': True, 'AeConstraintMode': 0, 'Brightness': 0.0, 'Contrast': 1.0, 'Saturation': 1.0, 'Sharpness': 1.0, 'AfMode': 0, 'ScalerCrop': [0, 0, 4608, 2592]}, 'rotation': {'hflip': 0, 'vflip': 0}, 'sensor-mode': 2, 'capture-settings': {'Resize': False, 'makeRaw': False, 'Resolution': 0, 'available-resolutions': [[4608, 2592], [2304, 1296], [1920, 1080], [1280, 720], [640, 360]]}}
{'Resize': False, 'makeRaw': False, 'Resolution': 0, 'available-resolutions': [[4608, 2592], [2304, 1296], [1920, 1080], [1280, 720], [640, 360]]}
[4608, 2592]
[1:11:58.517771279] [5828]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 1536x864-SBGGR10_CSI2P
[1:11:58.518357883] [5844]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
[1:11:58.534220510] [5828]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 2304x1296-SBGGR10_CSI2P
[1:11:58.534733818] [5844]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 2304x1296-SBGGR10_1X10 - Selected unicam format: 2304x1296-pBAA
[1:11:58.554731989] [5828]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 4608x2592-SBGGR10_CSI2P
[1:11:58.555365740] [5844]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 4608x2592-SBGGR10_1X10 - Selected unicam format: 4608x2592-pBAA
{'use_case': 'video', 'transform': <libcamera.Transform 'identity'>, 'colour_space': <libcamera.ColorSpace 'Rec709'>, 'buffer_count': 6, 'queue': True, 'main': {'format': 'XBGR8888', 'size': (4608, 2592)}, 'lores': None, 'raw': {'format': 'SRGGB10_CSI2P', 'size': (4608, 2592)}, 'controls': {'NoiseReductionMode': <NoiseReductionModeEnum.Fast: 1>, 'FrameDurationLimits': (33333, 33333)}, 'sensor': {'output_size': (4608, 2592), 'bit_depth': 10}, 'display': 'main', 'encode': 'main'}
{'Model': 'imx708_wide', 'UnitCellSize': (1400, 1400), 'ColorFilterArrangement': 0, 'Location': 2, 'Rotation': 180, 'PixelArraySize': (4608, 2592), 'PixelArrayActiveAreas': [(16, 24, 4608, 2592)], 'ScalerCropMaximum': (0, 0, 4608, 2592), 'SystemDevices': (20750, 20751, 20738, 20739, 20740), 'SensorSensitivity': 1.0}
INFO:picamera2.picamera2:Camera configuration has been adjusted!
[1:11:58.681543280] [5828]  INFO Camera camera.cpp:1183 configuring streams: (0) 4608x2592-XBGR8888 (1) 4608x2592-SBGGR10_CSI2P
[1:11:58.682449214] [5844]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 4608x2592-SBGGR10_1X10 - Selected unicam format: 4608x2592-pBAA
INFO:picamera2.picamera2:Configuration successful!
[1:11:59.371621240] [5844] ERROR V4L2 v4l2_videodevice.cpp:1241 /dev/video0[16:cap]: Unable to request 2 buffers: Cannot allocate memory
[1:11:59.372477786] [5844] ERROR RPI pipeline_base.cpp:663 Failed to allocate buffers
Traceback (most recent call last):
  File "/home/admin/.local/share/Trash/files/picamera2-WebUI-Lite-main-0.0.4/app.py", line 413, in <module>
    start_camera_stream()
  File "/home/admin/.local/share/Trash/files/picamera2-WebUI-Lite-main-0.0.4/app.py", line 283, in start_camera_stream
    picam2.start_recording(JpegEncoder(), FileOutput(output))
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1761, in start_recording
    self.start()
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1163, in start
    self.start_()
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1131, in start_
    self.camera.start(controls)
RuntimeError: Failed to start camera: Cannot allocate memory
INFO:picamera2.picamera2:Camera closed successfully.

To Reproduce Steps to reproduce the behavior:

  1. Download release v0.0.4 and extract to folder
  2. Create new venv using python -m venv --system-site-package venv (to access system packages like picamera2)
  3. Activate venv, cd into folder, and run python app.py (I might've installed flask first in the venv; can't remember)
  4. See error

Expected behavior The script start up without error.

Desktop (please complete the following information):

Additional context For reference, here are the packages installed / accessible through the venv:

python -m pip list
Package                            Version
---------------------------------- ----------
arandr                             0.1.11
asgiref                            3.6.0
astroid                            2.14.2
asttokens                          2.2.1
av                                 10.0.0
Babel                              2.10.3
beautifulsoup4                     4.11.2
blinker                            1.5
certifi                            2022.9.24
chardet                            5.1.0
charset-normalizer                 3.0.1
click                              8.1.3
colorama                           0.4.6
colorzero                          2.0
cryptography                       38.0.4
cupshelpers                        1.0
dbus-python                        1.3.2
dill                               0.3.6
distro                             1.8.0
docutils                           0.19
Flask                              2.2.2
gpiozero                           2.0
html5lib                           1.1
httplib2                           0.20.4
idna                               3.3
importlib-metadata                 4.12.0
isort                              5.6.4
itsdangerous                       2.1.2
jedi                               0.18.2
Jinja2                             3.1.2
lazr.restfulclient                 0.14.5
lazr.uri                           1.0.6
lazy-object-proxy                  1.9.0
lgpio                              0.2.2.0
libevdev                           0.5
logilab-common                     1.9.8
lxml                               4.9.2
MarkupSafe                         2.1.2
mccabe                             0.7.0
more-itertools                     8.10.0
mypy                               1.0.1
mypy-extensions                    0.4.3
numpy                              1.24.2
oauthlib                           3.2.2
olefile                            0.46
parso                              0.8.3
pexpect                            4.8.0
pgzero                             1.2
picamera2                          0.3.17
pidng                              4.0.9
piexif                             1.1.3
pigpio                             1.78
Pillow                             9.4.0
pip                                23.0.1
platformdirs                       2.6.0
psutil                             5.9.4
ptyprocess                         0.7.0
pycairo                            1.20.1
pycups                             2.0.1
pygame                             2.1.2
Pygments                           2.14.0
PyGObject                          3.42.2
pyinotify                          0.9.6
PyJWT                              2.6.0
pylint                             2.16.2
PyOpenGL                           3.1.6
pyOpenSSL                          23.0.0
pyparsing                          3.0.9
PyQt5                              5.15.9
PyQt5-sip                          12.11.1
pyserial                           3.5
pysmbc                             1.0.23
python-apt                         2.6.0
python-dotenv                      0.21.0
python-prctl                       1.8.1
pytz                               2022.7.1
pyudev                             0.24.0
reportlab                          3.6.12
requests                           2.28.1
requests-oauthlib                  1.3.0
responses                          0.18.0
roman                              3.3
RPi.GPIO                           0.7.1a4
RTIMULib                           7.2.1
Send2Trash                         1.8.1b0
sense-hat                          2.6.0
setuptools                         66.1.1
simplejpeg                         1.6.6
simplejson                         3.18.3
six                                1.16.0
smbus2                             0.4.2
soupsieve                          2.3.2
spidev                             3.5
ssh-import-id                      5.10
thonny                             4.1.4
toml                               0.10.2
tomlkit                            0.11.7
twython                            3.8.2
types-aiofiles                     22.1
types-annoy                        1.17
types-appdirs                      1.4
types-aws-xray-sdk                 2.10
types-babel                        2.11
types-backports.ssl-match-hostname 3.7
types-beautifulsoup4               4.11
types-bleach                       5.0
types-boto                         2.49
types-braintree                    4.17
types-cachetools                   5.2
types-caldav                       0.10
types-certifi                      2021.10.8
types-cffi                         1.15
types-chardet                      5.0
types-chevron                      0.14
types-click-spinner                0.1
types-colorama                     0.4
types-commonmark                   0.9
types-console-menu                 0.7
types-contextvars                  2.4
types-croniter                     1.3
types-cryptography                 3.3
types-D3DShot                      0.1
types-dateparser                   1.1
types-DateTimeRange                1.2
types-decorator                    5.1
types-Deprecated                   1.2
types-dj-database-url              1.0
types-docopt                       0.6
types-docutils                     0.19
types-editdistance                 0.6
types-emoji                        2.1
types-entrypoints                  0.4
types-first                        2.0
types-flake8-2020                  1.7
types-flake8-bugbear               22.10.27
types-flake8-builtins              2.0
types-flake8-docstrings            1.6
types-flake8-plugin-utils          1.3
types-flake8-rst-docstrings        0.2
types-flake8-simplify              0.19
types-flake8-typing-imports        1.14
types-Flask-Cors                   3.0
types-Flask-SQLAlchemy             2.5
types-fpdf2                        2.5
types-gdb                          12.1
types-google-cloud-ndb             1.11
types-hdbcli                       2.14
types-html5lib                     1.1
types-httplib2                     0.21
types-humanfriendly                10.0
types-invoke                       1.7
types-JACK-Client                  0.5
types-jmespath                     1.0
types-jsonschema                   4.17
types-keyboard                     0.13
types-ldap3                        2.9
types-Markdown                     3.4
types-mock                         4.0
types-mypy-extensions              0.4
types-mysqlclient                  2.1
types-oauthlib                     3.2
types-openpyxl                     3.0
types-opentracing                  2.4
types-paho-mqtt                    1.6
types-paramiko                     2.11
types-parsimonious                 0.10
types-passlib                      1.7
types-passpy                       1.0
types-peewee                       3.15
types-pep8-naming                  0.13
types-Pillow                       9.3
types-playsound                    1.3
types-polib                        1.1
types-prettytable                  3.4
types-protobuf                     3.20
types-psutil                       5.9
types-psycopg2                     2.9
types-pyaudio                      0.2
types-PyAutoGUI                    0.9
types-pycurl                       7.45
types-pyfarmhash                   0.3
types-pyflakes                     2.5
types-Pygments                     2.13
types-pyinstaller                  5.6
types-PyMySQL                      1.0
types-pynput                       1.7
types-pyOpenSSL                    22.1
types-pyRFC3339                    1.1
types-PyScreeze                    0.1
types-pysftp                       0.2
types-pytest-lazy-fixture          0.6
types-python-crontab               2.6
types-python-dateutil              2.8
types-python-gflags                3.1
types-python-jose                  3.3
types-python-nmap                  0.7
types-python-slugify               6.1
types-pytz                         2022.6
types-pyvmomi                      7.0
types-pywin32                      304
types-PyYAML                       6.0
types-redis                        4.3
types-regex                        2022.10.31
types-requests                     2.28
types-retry                        0.9
types-Send2Trash                   1.8
types-setuptools                   65.5
types-simplejson                   3.17
types-singledispatch               3.7
types-six                          1.16
types-slumber                      0.7
types-SQLAlchemy                   1.4.43
types-stdlib-list                  0.8
types-stripe                       3.5
types-tabulate                     0.9
types-termcolor                    1.1
types-toml                         0.10
types-toposort                     1.7
types-tqdm                         4.64
types-tree-sitter                  0.20
types-tree-sitter-languages        1.5
types-ttkthemes                    3.2
types-typed-ast                    1.5
types-tzlocal                      4.2
types-ujson                        5.5
types-urllib3                      1.26
types-vobject                      0.9
types-waitress                     2.1
types-whatthepatch                 1.0
types-xmltodict                    0.13
types-xxhash                       3.0
types-zxcvbn                       4.4
typing_extensions                  4.4.0
urllib3                            1.26.12
v4l2-python3                       0.3.3
wadllib                            1.3.6
webencodings                       0.5.1
Werkzeug                           2.2.2
wheel                              0.38.4
wrapt                              1.14.1
zipp                               1.0.0

What should I do to fix this?

Thanks!

monkeymademe commented 4 months ago

Which Version of pi camera is that? V3 or the Araducam? Could be a memory allocation issue but I am not sure. This system has not been tested on the Araducam (I don't have one)

Exper1mental commented 4 months ago

Hmm interesting... I'm using a Pi camera module 3 wide though. ¯\_(ツ)_/¯

monkeymademe commented 4 months ago

what happens when you type libcamera-hello can you paste the output (do that before going into the venv)

Also Raspberry Pi OS 64bit. --- lite or desktop ... trying to narrow down the issue

Exper1mental commented 4 months ago

Running libcamera-hello out of venv displayed the popup preview window as expected with a live view from the camera and gives the following output:

libcamera-hello
[6:52:16.986787243] [7603]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5
[6:52:17.033919132] [7606]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[6:52:17.036115052] [7606]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media1 and ISP device /dev/media2
[6:52:17.036193327] [7606]  INFO RPI pipeline_base.cpp:1144 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
Made X/EGL preview window
Mode selection for 2304:1296:12:P
    SRGGB10_CSI2P,1536x864/0 - Score: 3400
    SRGGB10_CSI2P,2304x1296/0 - Score: 1000
    SRGGB10_CSI2P,4608x2592/0 - Score: 1900
Stream configuration adjusted
[6:52:17.510516614] [7603]  INFO Camera camera.cpp:1183 configuring streams: (0) 2304x1296-YUV420 (1) 2304x1296-SBGGR10_CSI2P
[6:52:17.512707497] [7606]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 2304x1296-SBGGR10_1X10 - Selected unicam format: 2304x1296-pBAA

I'm using Raspberry Pi OS with Desktop 64-bit (Bookworm / Debian 12)

Exper1mental commented 4 months ago

I've submitted an issue on the Picamera2 Github repo. Seems like this may be a bug in the library? https://github.com/raspberrypi/picamera2/issues/972

monkeymademe commented 4 months ago

Going to abuse this to take the install notes

This what I did to get this working on 32bit Lite Pi OS

This was working for me... I am waiting on a SD card for 64bit

monkeymademe commented 4 months ago

I had forgotten you use v0.0.4 and yeah its still functioning so I am at a loss... I did have one issue with the 64bit version but when I reseated the cable it was fine.

Do you want to clean install the OS and try the above steps

Exper1mental commented 4 months ago

I initially was able to get this working by setting buffer_count=5 for picam2.create_video_configuration (the default is 6).

Upon further investigation, Visual Studio Code uses a small (~30 MB) amount of CMA memory and this was sufficient to cause the error. Closing VSC and running from Terminal allowed me to push the buffer count back to 6

Closing since this isn't a bug.

Some info for anyone who has this issue down the road:

grep Cma /proc/meminfo tells how much CMA memory is currently available and in-use.

dtoverlay -h vc4-fkms-v3d tells you what values your Pi will accept for defining CMA memory allocation.

Per page 58 (section 8.3) the Picamera2 manual, you can then edit the /boot/firmware/config.txt (previously /boot/config.txt) file to set CMA memory.

pstimpel commented 3 months ago

Just in case it helps ...

Raspian bookworm 32bit lite, Raspi 3B, fresh install. CMA memory config changes did not help, but I raised it to 320 and confirmed the settings are in use. What helped at the end: adding buffer_count=4 (!) to the statement creating the video config.

brbergami commented 1 month ago

I'm having a simillar issue. I guess mine is an Arducam (v1.3? It's ov5647 at least), can't tell exactly (info command welcomed).

I'm running DietPi 9.4.2 The error is the following:

root@DietPi:~/picamera2-WebUI-Lite# python3 app.py
[0:12:10.852686000] [2347]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[0:12:11.081730000] [2371]  WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:12:11.103053000] [2371]  INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media2 and ISP device /dev/media0
[0:12:11.104807000] [2371]  INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[0:12:11.131601000] [2347]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[0:12:11.329701000] [2374]  WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:12:11.350595000] [2374]  INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media2 and ISP device /dev/media0
[0:12:11.352322000] [2374]  INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'

Camera Config:
{'controls': {'LensPosition': 1.0, 'ExposureValue': 0.0, 'ExposureTime': 220417486, 'AwbMode': 0, 'AfSpeed': 0, 'AfRange': 0, 'AeMeteringMode': 0, 'AeFlickerPeriod': 1000000, 'AeFlickerMode': 0, 'AeExposureMode': 0, 'AeEnable': True, 'AwbEnable': True, 'AeConstraintMode': 0, 'Brightness': 0.0, 'Contrast': 1.0, 'Saturation': 1.0, 'Sharpness': 1.0, 'AfMode': 0, 'ScalerCrop': [0, 0, 4608, 2592]}, 'rotation': {'hflip': 0, 'vflip': 0}, 'sensor-mode': 0, 'capture-settings': {'Resize': False, 'makeRaw': False, 'Resolution': 0, 'available-resolutions': [[4608, 2592], [2304, 1296], [1920, 1080], [1280, 720], [640, 360]]}}

Camera Settings:
{'Resize': False, 'makeRaw': False, 'Resolution': 0, 'available-resolutions': [[4608, 2592], [2304, 1296], [1920, 1080], [1280, 720], [640, 360]]}

Camera Set Resolution:
[4608, 2592]

[0:12:11.439154000] [2347]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 640x480-SGBRG10_CSI2P
[0:12:11.442684000] [2374]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA
[0:12:11.518807000] [2347]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 1296x972-SGBRG10_CSI2P
[0:12:11.523524000] [2374]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
[0:12:11.621510000] [2347]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 1920x1080-SGBRG10_CSI2P
[0:12:11.624426000] [2374]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1920x1080-SGBRG10_1X10 - Selected unicam format: 1920x1080-pGAA
[0:12:11.809884000] [2347]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-XBGR8888 (1) 2592x1944-SGBRG10_CSI2P
[0:12:11.822447000] [2374]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 2592x1944-SGBRG10_1X10 - Selected unicam format: 2592x1944-pGAA

Video Config:
{'use_case': 'video', 'transform': <libcamera.Transform 'identity'>, 'colour_space': <libcamera.ColorSpace 'Rec709'>, 'buffer_count': 6, 'queue': True, 'main': {'format': 'XBGR8888', 'size': (4608, 2592)}, 'lores': None, 'raw': {'format': 'SGBRG10_CSI2P', 'size': (4608, 2592)}, 'controls': {'NoiseReductionMode': <NoiseReductionModeEnum.Fast: 1>, 'FrameDurationLimits': (33333, 33333)}, 'sensor': {'output_size': (640, 480), 'bit_depth': 10}, 'display': 'main', 'encode': 'main'}

Picamera2 Camera Properties:
{'Model': 'ov5647', 'UnitCellSize': (1400, 1400), 'ColorFilterArrangement': 2, 'Location': 2, 'Rotation': 0, 'PixelArraySize': (2592, 1944), 'PixelArrayActiveAreas': [(16, 6, 2592, 1944)], 'ScalerCropMaximum': (0, 0, 2592, 1944), 'SystemDevices': (20749, 20737, 20738, 20739), 'SensorSensitivity': 1.0}

INFO:picamera2.picamera2:Camera configuration has been adjusted!
[0:12:12.163953000] [2347]  INFO Camera camera.cpp:1183 configuring streams: (0) 4608x2592-XBGR8888 (1) 640x480-SGBRG10_CSI2P
[0:12:12.166702000] [2374]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA
INFO:picamera2.picamera2:Configuration successful!
Traceback (most recent call last):
  File "/root/picamera2-WebUI-Lite/app.py", line 508, in <module>
    start_camera_stream()
  File "/root/picamera2-WebUI-Lite/app.py", line 304, in start_camera_stream
    picam2.configure(video_config)
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1114, in configure
    self.configure_(camera_config)
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1097, in configure_
    self.allocator.allocate(libcamera_config, camera_config.get("use_case"))
  File "/usr/lib/python3/dist-packages/picamera2/allocators/dmaallocator.py", line 43, in allocate
    fd = self.dmaHeap.alloc(f"picamera2-{i}", stream_config.frame_size)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/picamera2/dma_heap.py", line 98, in alloc
    ret = fcntl.ioctl(self.__dmaHeapHandle.get(), DMA_HEAP_IOCTL_ALLOC, alloc)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 12] Cannot allocate memory
INFO:picamera2.picamera2:Camera closed successfully.

Also, when try running libcamera-hello:

root@DietPi:~/picamera2-WebUI-Lite# libcamera-hello
[0:15:15.074101000] [2590]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+120-eb00c13d
[0:15:15.436101000] [2600]  WARN RPiSdn sdn.cpp:40 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:15:15.457388000] [2600]  INFO RPI vc4.cpp:446 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media2 and ISP device /dev/media0
[0:15:15.459161000] [2600]  INFO RPI pipeline_base.cpp:1102 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
Preview window unavailable
Mode selection for 1296:972:12:P
    SGBRG10_CSI2P,640x480/0 - Score: 3296
    SGBRG10_CSI2P,1296x972/0 - Score: 1000
    SGBRG10_CSI2P,1920x1080/0 - Score: 1349.67
    SGBRG10_CSI2P,2592x1944/0 - Score: 1567
Stream configuration adjusted
[0:15:15.597634000] [2590]  INFO Camera camera.cpp:1183 configuring streams: (0) 1296x972-YUV420 (1) 1296x972-SGBRG10_CSI2P
[0:15:15.600346000] [2600]  INFO RPI vc4.cpp:621 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
#0 (0.00 fps) exp 33222.00 ag 8.00 dg 1.00
#1 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#2 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#3 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#4 (30.00 fps) exp 33222.00 ag 8.00 dg 1.00
#5 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#6 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#7 (30.00 fps) exp 33222.00 ag 8.00 dg 1.00
#8 (30.03 fps) exp 33222.00 ag 8.00 dg 1.00
#9 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#10 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#11 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#12 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#13 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#14 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#15 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#16 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#17 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#18 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#19 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#20 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#21 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#22 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#23 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#24 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#25 (30.00 fps) exp 33222.00 ag 8.00 dg 1.00
#26 (30.03 fps) exp 33222.00 ag 8.00 dg 1.00
#27 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#28 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#29 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#30 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#31 (30.03 fps) exp 33222.00 ag 8.00 dg 1.00
#32 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#33 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#34 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#35 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#36 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#37 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#38 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#39 (30.00 fps) exp 33222.00 ag 8.00 dg 1.00
#40 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#41 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#42 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#43 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#44 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#45 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#46 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#47 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#48 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#49 (30.03 fps) exp 33222.00 ag 8.00 dg 1.00
#50 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#51 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#52 (30.00 fps) exp 33222.00 ag 8.00 dg 1.00
#53 (30.03 fps) exp 33222.00 ag 8.00 dg 1.00
#54 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#55 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#56 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#57 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#58 (30.00 fps) exp 33222.00 ag 8.00 dg 1.00
#59 (30.04 fps) exp 33222.00 ag 8.00 dg 1.00
#60 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#61 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#62 (30.01 fps) exp 33222.00 ag 8.00 dg 1.00
#63 (30.02 fps) exp 33222.00 ag 8.00 dg 1.00
#64 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#65 (30.00 fps) exp 33222.00 ag 7.94 dg 1.01
#66 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#67 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#68 (30.01 fps) exp 33222.00 ag 7.94 dg 1.01
#69 (30.03 fps) exp 33222.00 ag 7.94 dg 1.01
#70 (30.01 fps) exp 33222.00 ag 7.94 dg 1.01
#71 (30.01 fps) exp 33222.00 ag 7.94 dg 1.01
#72 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#73 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#74 (30.00 fps) exp 33222.00 ag 7.94 dg 1.01
#75 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#76 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#77 (30.01 fps) exp 33222.00 ag 7.94 dg 1.01
#78 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#79 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#80 (30.01 fps) exp 33222.00 ag 7.94 dg 1.01
#81 (30.02 fps) exp 33222.00 ag 7.94 dg 1.01
#82 (30.02 fps) exp 33222.00 ag 7.88 dg 1.02
#83 (30.01 fps) exp 33222.00 ag 7.88 dg 1.02
#84 (30.01 fps) exp 33222.00 ag 7.88 dg 1.02
#85 (30.02 fps) exp 33222.00 ag 7.88 dg 1.02
#86 (30.01 fps) exp 33222.00 ag 7.88 dg 1.02
#87 (30.02 fps) exp 33222.00 ag 7.88 dg 1.02
#88 (30.02 fps) exp 33222.00 ag 7.88 dg 1.02
#89 (30.01 fps) exp 33222.00 ag 7.88 dg 1.02
#90 (30.02 fps) exp 33222.00 ag 7.88 dg 1.02
#91 (30.02 fps) exp 33222.00 ag 7.88 dg 1.02
#92 (30.01 fps) exp 33222.00 ag 7.88 dg 1.02
#93 (30.01 fps) exp 33222.00 ag 7.88 dg 1.02
#94 (30.02 fps) exp 33222.00 ag 7.88 dg 1.02
#95 (30.01 fps) exp 33222.00 ag 7.88 dg 1.02
^C

I'm running this using python3, didn't digged too much in the repo code to tell if that's a difference, but as I found this issue opened, discarded that to be the reason. Hope the info helps.