Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ImportError: cannot import name 'V4L2_CID_MPEG_VIDEO_H264_PROFILE' from 'v4l2' #1022

Open
san4s204 opened this issue Apr 25, 2024 · 1 comment

Comments

@san4s204
Copy link

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

@davidplowman
Copy link
Collaborator

Hi, it sounds like you have an out of date version of python3-v4l2 - the latest is 0.3.4. Please update it and try again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants