Question: I have Raspberry pi 6 4 - bit bullseye system. I want to make my raspberry pi camera module 2 to work so this is

I have Raspberry pi 64-bit bullseye system. I want to make my raspberry pi camera module 2 to work so this is the code I used to check if the raspberry pi camera works.
The code I used:
from picamera2 import Picamera2
picam2= Picamera2()
picam2.start_and_record_video("test1.mp4", duration=7)
This works well when I used Thonny application but I seem to have a problem when I run this in Pycharm. Error is No module named 'libcamera'. So this is what I tried to do to fix the problem:
I did this with the virtual environment in pycharm:
sudo apt install -y libcamera-dev
pip install rpi-libcamera
Error:
Problem encountered: This package works with libcamera version v0.2.0+46-075b54d5, but you have version v0.0.5+83-bde9b04f installed. Please check the readme for help with this error
A full log can be found at /tmp/pip-install-_dqto4ek/rpi-libcamera_3a86d81863ba4e91860a28fd2d675c0f/.mesonpy-br23v3ff/meson-logs/meson-log.txt
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
\times Encountered error while generating package metadata.
> See above for output.
note: This is an issue with the package mentioned above, not pip.
From what i gathered, installing libcamera in a virtual environment seems to be tricky but I really need to use pycharm for my project. Please take note that picamera2 seems to be the latest version for the raspberry pi camera to work. I hope you can show me the steps on how to fix my libcamera installation within a virtual environment. I am using python language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!