You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To Reproduce
Hello, I wrote down a code in order to do facial_recognition with my raspberry pi 5. I use a picamera module 3.
I followed the tutorial a first time. And everything went well and perfect.
However, after reinitializating my raspberry pi. Setting my conda environment, downloading all my librairies. My code wasn't working anymore.
So I went back to my test.py as follow :
from picamera2 import Picamera2, Preview
import time
picam2 = Picamera2()
camera_config = picam2.create_preview_configuration()
picam2.configure(camera_config)
picam2.start_preview(Preview.QTGL)
picam2.start()
time.sleep(2)
picam2.capture_file("test.jpg")
and saw that the camera was SUPER zoomed. Like x30. I don't understand why. Because here's the step :
from picamera2 import Picamera2, Preview
import time
picam2 = Picamera2()
picam2.start_preview(Preview.QTGL)
camera_config = picam2.create_preview_configuration()
picam2.configure(camera_config)
picam2.start()
time.sleep(5)
picam2.close() #Remove the sleep and close if you want to close it manually with ctrl+C.
Don't ask me why or how, I don't know.
Is it possible to update the manual ? That's quite annoying to follow tutorials that aren't up to date haha.
Hi, can you just confirm you Picamera2 version (apt list python3-picamera2)? I know there was a crazy zoom-related bug a little while back.
I also don't know anything much about anaconda, but could that somehow mean you're not using the version of Picamera2 that you expect? I've tried your original script with a vanilla installation (i.e. no conda, no virtual environments), and it seems to work OK for me.
Do you have a spare SD card lying around where you could install a clean version of Raspberry Pi OS. Don't add anything else to it (except for sudo apt update and sudo apt full-upgrade), so no conda environments, and then just try if the zoom problem is present or not?
Not sure either, I'm afraid! I'm wondering whether there's some kind of issue where the Picamera2 version gets coped/frozen when a conda environment is set up and then doesn't update (even though the system version does). Is that possible? Generally when you import a module you can look at module.__file__ which will give you a clue as to where it's being loaded from. Does that suggest anything?
Upgrading python3-libcamera from 0.3.2+rpt20240927-1 to 0.4.0+rpt20250213-1 solves it.
sudo apt install --only-upgrade python3-libcamera
Here is the output
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
libcamera-ipa libcamera-tools libcamera0.4 libpisp-common libpisp1
The following NEW packages will be installed:
libcamera0.4
The following packages will be upgraded:
libcamera-ipa libcamera-tools libpisp-common libpisp1 python3-libcamera
5 upgraded, 1 newly installed, 0 to remove and 170 not upgraded.
Need to get 2,445 kB of archives.
After this operation, 1,225 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.raspberrypi.com/debian bookworm/main arm64 libpisp1 arm64 1.1.0-1 [282 kB]
Get:2 http://archive.raspberrypi.com/debian bookworm/main arm64 libpisp-common all 1.1.0-1 [4,908 B]
Get:3 http://archive.raspberrypi.com/debian bookworm/main arm64 libcamera0.4 arm64 0.4.0+rpt20250213-1 [656 kB]
Get:4 http://archive.raspberrypi.com/debian bookworm/main arm64 libcamera-ipa arm64 0.4.0+rpt20250213-1 [836 kB]
Get:5 http://archive.raspberrypi.com/debian bookworm/main arm64 libcamera-tools arm64 0.4.0+rpt20250213-1 [335 kB]
Get:6 http://archive.raspberrypi.com/debian bookworm/main arm64 python3-libcamera arm64 0.4.0+rpt20250213-1 [330 kB]
Fetched 2,445 kB in 0s (5,544 kB/s)
Reading changelogs... Done
(Reading database ... 123517 files and directories currently installed.)
Preparing to unpack .../0-libpisp1_1.1.0-1_arm64.deb ...
Unpacking libpisp1:arm64 (1.1.0-1) over (1.0.7-1) ...
Preparing to unpack .../1-libpisp-common_1.1.0-1_all.deb ...
Unpacking libpisp-common (1.1.0-1) over (1.0.7-1) ...
Selecting previously unselected package libcamera0.4:arm64.
Preparing to unpack .../2-libcamera0.4_0.4.0+rpt20250213-1_arm64.deb ...
Unpacking libcamera0.4:arm64 (0.4.0+rpt20250213-1) ...
Preparing to unpack .../3-libcamera-ipa_0.4.0+rpt20250213-1_arm64.deb ...
Unpacking libcamera-ipa:arm64 (0.4.0+rpt20250213-1) over (0.3.2+rpt20240927-1) ...
Preparing to unpack .../4-libcamera-tools_0.4.0+rpt20250213-1_arm64.deb ...
Unpacking libcamera-tools (0.4.0+rpt20250213-1) over (0.3.2+rpt20240927-1) ...
Preparing to unpack .../5-python3-libcamera_0.4.0+rpt20250213-1_arm64.deb ...
Unpacking python3-libcamera:arm64 (0.4.0+rpt20250213-1) over (0.3.2+rpt20240927-1) ...
Setting up libpisp-common (1.1.0-1) ...
Setting up libpisp1:arm64 (1.1.0-1) ...
Setting up libcamera-ipa:arm64 (0.4.0+rpt20250213-1) ...
Setting up libcamera0.4:arm64 (0.4.0+rpt20250213-1) ...
Setting up libcamera-tools (0.4.0+rpt20250213-1) ...
Setting up python3-libcamera:arm64 (0.4.0+rpt20250213-1) ...
Processing triggers for libc-bin (2.36-9+rpt2+deb12u9) ...
Activity
Rob-Nafous commentedon Mar 18, 2025
I will let an admin close this issue. But the error is quite 'stupid'
Just, we need to put the preview before the configuration. Which isn't the case in the user manual : https://datasheets.raspberrypi.com/camera/picamera2-manual.pdf
Do as follow :
Don't ask me why or how, I don't know.
Is it possible to update the manual ? That's quite annoying to follow tutorials that aren't up to date haha.
Thanks a lot.
davidplowman commentedon Mar 20, 2025
Hi, can you just confirm you Picamera2 version (
apt list python3-picamera2)? I know there was a crazy zoom-related bug a little while back.I also don't know anything much about anaconda, but could that somehow mean you're not using the version of Picamera2 that you expect? I've tried your original script with a vanilla installation (i.e. no conda, no virtual environments), and it seems to work OK for me.
Rob-Nafous commentedon Mar 20, 2025
Hello david,
python3-picamera2/stable,stable,now 0.3.25-1 all [installed]I followed the instruction in first place after creating my conda environment. I'm not an expert either so couldn't help more I am sorry.
davidplowman commentedon Mar 20, 2025
Do you have a spare SD card lying around where you could install a clean version of Raspberry Pi OS. Don't add anything else to it (except for
sudo apt updateandsudo apt full-upgrade), so no conda environments, and then just try if the zoom problem is present or not?Rob-Nafous commentedon Mar 20, 2025
I might have one at home, I'll try it tomorrow and let you know how it works :)
Rob-Nafous commentedon Mar 21, 2025
Hi David,
So yeah, it works with an empty SD. I don't understand how a conda environment can change the comportment?
davidplowman commentedon Mar 21, 2025
Not sure either, I'm afraid! I'm wondering whether there's some kind of issue where the Picamera2 version gets coped/frozen when a conda environment is set up and then doesn't update (even though the system version does). Is that possible? Generally when you import a module you can look at
module.__file__which will give you a clue as to where it's being loaded from. Does that suggest anything?sonnyp commentedon Apr 2, 2025
We had the same issue after upgrading to bookworm 2024-11-19 on https://www.planktoscope.org/
Upgrading python3-libcamera from
0.3.2+rpt20240927-1to0.4.0+rpt20250213-1solves it.Here is the output
os: Upgrade python3-libcamera to fix issue on bookworm
os: Upgrade python3-libcamera to fix issue on bookworm
os: Upgrade python3-libcamera to fix issue on bookworm
os: Upgrade python3-libcamera to fix issue on bookworm
os: Upgrade python3-libcamera to fix issue on bookworm
os: Upgrade python3-libcamera to fix issue on bookworm (#551)