Sunday, October 4, 2015

Install and test python-gphoto2 (Python interface to libgphoto2) on Raspberry Pi 2/Raspbian Jessie - fail

python-gphoto2 is a comprehensive Python interface (or binding) to libgphoto2.

Before install python-gphoto2, we have to install libgphoto2, I run the gphoto2-updater script to install gphoto2 and libgphoto2 on Raspberry Pi 2/Raspbian Jessie. After finished, gphoto2 2.5.8 and libgphoto2 2.5.4 will be installed.


- Install python-dev
sudo apt-get install python-dev

- install python-gphoto2 with pip
sudo pip install gphoto2

If you installed with pip the example files should be in /usr/share/python-gphoto2/examples or /usr/local/share/python-gphoto2/examples or somewhere similar. Otherwise they are in the examples sub-directory of your working directory. In Raspbian Jessie, it should be in /usr/local/share/python-gphoto2/examples.

Connect a digital camera to your Raspberry Pi, switch it on, and unmount it before access with Python, and try one of the example programs:

$ python camera-summary.py


In my first test, I can run example of camera-summary.py to list details of the connected camera, but fail to capture image, with Segmentation fault!



In order to verify the steps, I redo it on Raspberry Pi (1st generation, NOT 2)/Raspbian Wheezy. Read "Install python-gphoto2 on Raspberry Pi/Raspbian Wheezy - success".


Updated@2015-12-03:
After install both gphoto and libgphoto2 of the same version 2.5.9, we can install python-gphoto2 and capture image successful.


5 comments:

Jim said...

I'm Jim Easterbrook, the developer of python-gphoto2. I'm sorry you weren't successful with your first attempt. Unfortunately segmentation faults aren't very informative and can be hard to track down.

One possibility is that python-gphoto2 was compiled (during installation) using header files from an earlier version of libgphoto2. Do you know if the updater script over writes any existing header files?

Andr.oid Eric said...

hello Jim,

I don't know if the updater script over writes any existing header files.

But, as you see in the video, I don't know why the compiled gphoto2 is 2.5.8, but the libgphoto2 is 2.5.4.

Jim said...

I think that's something to raise with the script's author.

Andr.oid Eric said...

Agree, Raspbian just official for a short time, may be they will update soon - I hope:)

Andr.oid Eric said...

hello Jim,

FYI
After install both gphoto and libgphoto2 of the same version 2.5.9 (http://helloraspberrypi.blogspot.com/2015/12/install-gphoto2-libgphoto2-version-259.html), I can install python-gphoto2 and capture image successful(http://helloraspberrypi.blogspot.com/2015/12/install-python-gphoto2-on-raspberry-pi.html).