[BUG] ImportError: cannot import name 'V4L2_CID_MPEG_VIDEO_H264_PROFILE' from 'v4l2'
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- embedded-iot
Research direction
Start with picamera2/encoders/h264_encoder.py and compare its imported H.264 constants with the installed v4l2.py reported in the traceback. Reproduce the Python 3 import failure, then verify that importing Picamera2 completes without the ImportError.
Written by the indexing model from the issue text.
Description
Please only report one bug per issue!
Describe the bug
Cannot use picamera2 with OpenCV
To Reproduce
If you have the same issue
$python3
Expected behaviour
No error when importing picamera2
Console Output, Screenshots
Traceback (most recent call last):
File "/home/dima/Desktop/test.py", line 2, in
from picamera2 import Picamera2
File "/usr/lib/python3/dist-packages/picamera2/init.py", line 9, in
from .picamera2 import Picamera2, Preview
File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 26, in
from picamera2.encoders import Encoder, H264Encoder, MJPEGEncoder, Quality
File "/usr/lib/python3/dist-packages/picamera2/encoders/init.py", line 21, in
from .h264_encoder import H264Encoder
File "/usr/lib/python3/dist-packages/picamera2/encoders/h264_encoder.py", line 3, in
from v4l2 import (V4L2_CID_MPEG_VIDEO_H264_I_PERIOD,
ImportError: cannot import name 'V4L2_CID_MPEG_VIDEO_H264_PROFILE' from 'v4l2' (/home/dima/cv/lib/python3.11/site-packages/v4l2.py)
Hardware :
Please state what kind of Pi you are using, and what camera is attached.
Additional context
Add any other context about the problem here.
Raspberry Pi 4 Model B Rev 1.5
Raspberry Pi Camera rev 1.3
Name: v4l2-python3
Version: 0.3.2
Summary: Python bindings for the v4l2 userspace api.
Home-page: https://pypi.org/project/v4l2-python3/
Author:
Author-email:
License: GPLv2
Location: /home/dima/cv/lib/python3.11/site-packages
Name: picamera2
Version: 0.3.18
Summary: The libcamera-based Python interface to Raspberry Pi cameras, based on the original Picamera library
Home-page: https://github.com/RaspberryPi/picamera2
Author: Raspberry Pi & Raspberry Pi Foundation
Author-email: picamera2@raspberrypi.com
License: BSD 2-Clause License
Location: /usr/lib/python3/dist-packages
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 258
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from raspberrypi/picamera2
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
raspberrypi/picamera2#1405 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
raspberrypi/picamera2#1404 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 57/100
raspberrypi/picamera2#1403 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
raspberrypi/picamera2#1392 · 13 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
raspberrypi/picamera2#1389 · 4 comments ·
All issues in raspberrypi/picamera2
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100