Hi, I’m trying to get my Arducam 8MP camera working on a Raspberry Pi 4 and I keep hitting an error. I’m running the Python example that came with it (I think the file is called FocuserExample.py, though I might be misreading the name) and it fails immediately with:
AttributeError: module ‘libcamera’ has no attribute ‘libcamera’
I’m not sure what I did wrong. Has anyone seen this before? The camera is an Arducam 8MP, the model number on the box is B01678MP. Only one unit. Thanks!
Hey there, thanks for the details. A few quick questions so I can point you in the right direction:
Are you on a fresh Raspberry Pi OS install, or has this Pi been used with other camera libraries before?
Did you install the Arducam software using their install script, or did you set things up manually?
Can you paste the exact traceback? The full output usually includes the line in the script that’s failing.
That error message (module 'libcamera' has no attribute 'libcamera') usually means Python is importing the wrong libcamera package, or there’s a mix of the system libcamera and a pip-installed one. Let’s narrow it down.
It’s Raspberry Pi 4, and I did install the Arducam software with their installer script. Not a totally fresh OS but I don’t think I had any camera stuff installed before.
Here’s the full output when I run it:
Traceback (most recent call last):
File “FocuserExample.py”, line 12, in
from libcamera import libcamera
AttributeError: module ‘libcamera’ has no attribute ‘libcamera’
I’ve tried running it a couple of times and it’s always the same. I also tried just plain running the camera normally and that’s fine, it’s only the example script that blows up.
OK that traceback is helpful. So the script is doing from libcamera import libcamera, and Python is loading a libcamera module that doesn’t contain a libcamera attribute. On the Pi there are actually a few different things that can be named libcamera:
the C++/system libcamera used by the camera stack
the libcamera Python bindings that come bundled with Raspberry Pi OS
a separate pip package also called libcamera
If a pip version got pulled in alongside the system one, the import can resolve to the wrong module and you get exactly this AttributeError.
First thing I want to check is what’s actually installed for Python. Run this in the terminal and send me a screenshot of the output:
pip3 list | grep libcamera
That’ll tell us which libcamera-related Python packages are present, and from there we can figure out whether it’s a conflict or just a missing binding.
That’s exactly what I was worried about. libcamera 0.0.1 is the generic pip package, not the Raspberry Pi system bindings. Those two things share the name but they’re not the same library, which is why from libcamera import libcamera can’t find what it’s looking for.
The system bindings usually come from the python3-libcamera apt package rather than pip, so having only the pip libcamera 0.0.1 installed is a strong candidate for the root cause here.
Before I tell you to change anything, let’s confirm the rest of the picture. Can you run these two and send screenshots:
pip3 list | grep -i arducam
apt list --installed 2>/dev/null | grep -i libcamera
The first shows whether the Arducam helper packages installed, the second shows whether the apt-side libcamera bindings are present at all.
That actually tells us a lot. So on your system we have:
apt libcamera0 0.0.0-1 (the system runtime library, but not necessarily the Python bindings)
pip libcamera 0.0.1 (the unrelated pip package shadowing it for Python)
no Arducam pip helper package showing up
The python3-libcamera bindings (the ones that actually expose the libcamera module the example expects) aren’t showing as installed, and the pip libcamera 0.0.1 is sitting on top of the import path. That combination lines up almost perfectly with module 'libcamera' has no attribute 'libcamera'.
At this point I don’t want you to just start uninstalling things blindly and break your camera stack, so let me get one more piece of data. Can you tell me which Python you’re running the script with, and run:
Yep, that confirms it. /home/pi/.local/lib/python3.9/site-packages/libcamera/__init__.py is the pip-installed package, and because user site-packages take priority over the system location, Python grabs that one instead of the Raspberry Pi libcamera bindings. That’s the shadowing I suspected earlier.
So current state of the diagnosis:
The error is an import-resolution problem, not a hardware fault with the camera itself.
The pip libcamera 0.0.1 package is intercepting import libcamera.
The system python3-libcamera bindings that the example expects don’t appear to be installed/enabled on the Python path your script is using.
We haven’t applied a fix yet, so I don’t want you to change anything until we’ve confirmed the last bit. Next step: let me know if the Arducam install script also dropped anything into /usr/lib/python3/dist-packages/ for libcamera, and run a quick check to see if the system bindings exist on disk:
ls /usr/lib/python3/dist-packages/ | grep -i libcamera
If you can send a screenshot of that output, plus a screenshot of pip3 list | grep libcamera, that gives me the full picture. Once I see it I’ll walk you through resolving the conflict (likely a matter of removing the pip package and pointing the script at the correct bindings) — but I want the diagnostic output first so we don’t remove the wrong thing.
I’ll also send you a small set of step-by-step instructions over private message so we can keep the thread clean, but please post the command output here so it’s on record.
Correct — nothing in /usr/lib/python3/dist-packages/ for libcamera means the Raspberry Pi Python bindings are genuinely missing, so we’re not just dealing with shadowing; the package the example depends on basically isn’t there.
Let’s pause before installing anything though. I want to confirm which bindings the Arducam example actually expects for your model, because the 8MP B01678MP kit has a couple of software paths depending on the driver setup, and I don’t want you pulling in a package version that mismatches your kernel/camera stack.
Summary of where we are:
Arducam 8MP (B01678MP) on Raspberry Pi 4, error AttributeError: module 'libcamera' has no attribute 'libcamera'.
The pip libcamera 0.0.1 package is being imported instead of the real bindings (confirmed via libcamera.__file__).
System python3-libcamera bindings are not present, and no Arducam pip helper package is installed.
Root cause is an import/packaging mismatch, not a camera hardware failure.
I haven’t sent a confirmed fix yet because we still need to match the right binding version. I’ve messaged you privately with the specific steps to try, but please reply here with the output of:
pip3 list | grep libcamera
so everything is documented for anyone else hitting the same error. Once I see the current state after you check my private note, we’ll finalize the fix.