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

python bindings when building from scratch #170

Closed
pbaetens opened this issue Aug 30, 2024 · 5 comments
Closed

python bindings when building from scratch #170

pbaetens opened this issue Aug 30, 2024 · 5 comments

Comments

@pbaetens
Copy link

pbaetens commented Aug 30, 2024

Hi all,

situation:

I build latest libcam and rpicam-apps from scratch.
commands like rpicam-hello work fine.
However, the python binding is not working.

python -m venv --system-site-packages venv
source venv/bin/activate
python
>>> import libcamera
>>> ModuleNotFoundError

Solution:
create a symbolic link to a place where python can find the .so file
sudo ln -sf /usr/local/lib/aarch64-linux-gnu/python3.11/site-packages/libcamera /usr/local/lib/python3.11/dist-packages/libcamera

OS: Bookworm

Question:
is this the way to do it, or is there a better way?

@naushir
Copy link
Collaborator

naushir commented Sep 2, 2024

@pbaetens thanks for the info. I must admit, python and venv is not something I am very familiar with, so I cannot say if there is a better way than what you described.

@davidplowman @XECDesign is this a solution to the venv issue we were talking about last week?

@pbaetens
Copy link
Author

pbaetens commented Sep 2, 2024

seems related to:
https://patchwork.libcamera.org/patch/19186/
So there is a patch in upstream libcamera but not yet merged.
@kbingham @will-v-pi

@kbingham
Copy link
Collaborator

kbingham commented Sep 2, 2024

I've hit this a few times and I just set the python path which is another "work around". But I would love to see this resolved more globally too.

@will-v-pi there are comments from Tomi for you. Do you have time to reply to the patch please?

@will-v-pi
Copy link
Collaborator

@kbingham I think the decision on that patch was not to merge it, as the behaviour that I was looking for wasn't cleanly compatible with cross-compilation? The patch was getting a bit complicated, and wasn't actually required for my rpi-libcamera pip package to compile. Tomi also mentioned that it would still install to an incorrect path on his PC, as that patch would install everything to site-packages whereas his PC only searched for dist-packages, so it's possibly not the correct solution to this problem?

I have a small downstream patch in raspberrypi/pylibcamera which I'm using to build the rpi-libcamera pip package, but that's specifically for building just the python bindings within that repository, rather than the whole of libcamera.

@naushir
Copy link
Collaborator

naushir commented Oct 7, 2024

From the above comments, I don't think there's anything we are able to do here...

@naushir naushir closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
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

4 participants