-
Notifications
You must be signed in to change notification settings - Fork 181
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] Raspberry Pi 4: Cannot import name 'Size' or 'ControlType' from libcamera depending on version of libcamera #218
Comments
Looks like I'm seeing the same issue in #217 |
To install libcamera you need to do Do you mind also running:
The version should be 0.2.3 If it's not, could you do:
|
Note @swordsmanluke is using the Arducam version of libcamera. |
What camera version do you use ? I've either Arducam Motorized Cameras imx219 (SKU: B0393) and imx477 (SKU: B0272)
|
Thanks! Here's my picamera2 version: 0.2.3
Trying to apt-install libcamera yields:
@shineworld
|
This is my list of commands JUST after installing a clean Raspberry Pi4 Bulleyes 64-bit (64-bit is a MUST to have all to work):
Use dmesg to know if all working fine:
At this point libcamera-apps are already installed and working:
Follow activity to enable camera focus motor management (if camera support it because motorized):
Packages to install to have Picamera2, OpenCV working:
|
@swordsmanluke I think your python interpreter is finding the arducam version of libcamera by the looks of it still. Can you uninstall that. Something like: |
As far as I know the Arducam version of libcamera installs in /usr/local/lib and the 'official' apt version in /usr/lib. |
"When I enable "Legacy Camera Support" in raspi-config, picamera2 fails to import 'Size' from libcamera." Are you sure that Picamera2 is compatible with Legacy camera support? I never used legacy camera management so try to check if this is the point. |
@shineworld: You are correct about the Legacy camera support. It is hinted at in the Raspberry Pi Camera Documentation. and mentioned in this linked RPi news post. Particularly, it implies that one needs to stick with Picamera if using the legacy stack:
Is there a way Picamera2 can detect if the legacy option is enabled or use this Size error to give the user a meaningful error message? |
@shineworld I'm actually using this camera so I put "ov5647" in boot/config.txt camera_auto_detect=0
dtoverlay=ov5647 I never would have gotten any of this figured out without your detailed instructions. Thank you. |
@shineworld I have been fighting to get my camera working for the past 3 weeks and your instructions are the first and only ones that actually worked. Thank you SOO Much! I wish I could buy you a beer (or 5!). Truly appreciate you. |
One last question on this though... Now that I finally have libcam working with my pi. It seems that I have lost the ability to do Autofocus. The Autofocus capability of the Arducam seems to come from libcamera_dev. But if I install libcamera_dev after everything else above, it breaks everything. Any ideas how to get autofocus working? I'm working with the IMX519 FYI. |
Hai guys I am start up in Raspberry Pi I have bought ArduCAM PTZ-IMX477 12MP (B016712MP) camera and Raspberry pi 4B 2GB last week. "ImportError: cannot import name 'ControlType' from 'libcamera' (/home/system/.local/lib/python3.9/site-packages/libcamera.cpython-39-arm-linux-gnueabihf.so)" I have followed the Arducam official site procedure but I have facing this error.. And I have tried libcamera-still and libcamera-hello i can able to open the camera but unable to focus manually... Just receiving the same blur image on all commands. On the hardware segment i have check manytimes and also test the camera's servo motor by twisting slowly in my hand and libcamera-still the servo is working.. system@raspberrypi: system@raspberrypi:~/PTZ-Camera-Controller $ libcamera-hello --list-cameras
|
libcamera now uses Orientations instead of Transforms. We shall just convert transparently between them so as not to change our API. Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Describe the bug
I can't seem to import from picamera2 regardless of the libcamera version I'm using.
When I enable "Legacy Camera Support" in raspi-config, picamera2 fails to import 'Size' from libcamera.
When I install a more recent libcamera, picamera2 fails to import 'ControlType'.
I also checked the libcamera API documentation (https://www.libcamera.org/api-html/classes.html) and I don't see a ControlType class?
Is there a recommended version of libcamera to install?
To Reproduce
Raspberry Pi 4 (4 GB RAM model)
Raspberry PI OS Lite (32 bit, Buster-base Release 2022-04-04)
Sample program:
Install picamera2 with no gui according to workaround here: #184
In
sudo raspi-config
Interface Options -> Legacy Camera, enable Legacy Camera suport. RebootRun sample program. Note "cannot import name 'Size'" error
Install libcamera from wheel: https://github.com/ArduCAM/RaspberryPi/blob/master/Motorized_Focus_Camera/python/libcamera-1.0.2-cp39-cp39-linux_armv7l.whl
python3 -m pip install ./libcamera-1.0.2-cp39-cp39-linux_armv7l.whl
Run sample program. Note "cannot import name 'ControlType'"
Expected behaviour
importing PiCamera works
Console Output, Screenshots
With "legacy camera"
With more recent libcamera:
$ sudo ldconfig -v | grep camera
libcamera-base.so.0 -> libcamera-base.so.0.0.0
$ sudo ldconfig -v | grep camera
$
The text was updated successfully, but these errors were encountered: