jim-easterbrook / python-gphoto2

Python interface to libgphoto2
GNU Lesser General Public License v3.0
366 stars 59 forks source link

having trouble getting gphoto2 on rpi #164

Open 3ricj opened 11 months ago

3ricj commented 11 months ago

This page is for reporting problems with the Python interface to libgphoto2. If your question is about using libgphoto2 you should ask on the gphoto2 mailing list.

Your system What version of Python are you using? python 3.9.2, on a rpi 64bit on bulldog.

What version of libgphoto2 have you installed? it looks like I have 2.5.27 installed.

How have you installed (or attempted to install) python-gphoto2? Following the instructions for rpi:

$ sudo apt install libexif12 libgphoto2-6 libgphoto2-port12 libltdl7 $ pip3 install gphoto2 --user

Your problem Please describe what you are trying to do and what goes wrong. A short Python script that shows the problem may be useful.

`camtraption@camtraption:~ $ pip3 install gphoto2 --user Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting gphoto2 Downloading gphoto2-2.5.0.tar.gz (497 kB) |████████████████████████████████| 497 kB 5.5 MB/s Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: /usr/bin/python3 /tmp/tmp_imc6u8t_in_process.py get_requires_for_build_wheel /tmp/tmpxz7wqu35 cwd: /tmp/pip-install-_d5ivo24/gphoto2_6d564798746b4abf9fbed8d9e5cf904c Complete output (25 lines): Traceback (most recent call last): File "", line 101, in File "/usr/lib/python3.9/subprocess.py", line 424, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.9/subprocess.py", line 528, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['pkg-config', '--modversion', 'libgphoto2']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/tmp/tmp_imc6u8t_in_process.py", line 280, in main() File "/tmp/tmp_imc6u8t_in_process.py", line 263, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/tmp/tmp_imc6u8t_in_process.py", line 114, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-80s9x9lm/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/pip-build-env-80s9x9lm/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-80s9x9lm/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 341, in run_setup exec(code, locals()) File "", line 104, in RuntimeError: ERROR: command "pkg-config --modversion libgphoto2" failed

WARNING: Discarding https://files.pythonhosted.org/packages/d9/e0/03167246c2d32d2b646cbd7f1bf424e3e0b52c319d5cc2d72da3998ed141/gphoto2-2.5.0.tar.gz#sha256=97d07a3c42067fcae4525600a4ecad5b6b3d3a181cc4c1d594381f411e599e80 (from https://pypi.org/simple/gphoto2/). Command errored out with exit status 1: /usr/bin/python3 /tmp/tmp_imc6u8t_in_process.py get_requires_for_build_wheel /tmp/tmpxz7wqu35 Check the logs for full command output.`

It then loops over and over again downloading older versions with the same error message.

$ sudo pkg-config --modversion libgphoto2 Package libgphoto2 was not found in the pkg-config search path. Perhaps you should add the directory containinglibgphoto2.pc' to the PKG_CONFIG_PATH environment variable No package 'libgphoto2' found `

$ sudo find /usr/lib | grep libgphoto2 /usr/lib/aarch64-linux-gnu/libgphoto2_port.so.12.0.0 /usr/lib/aarch64-linux-gnu/libgphoto2.so.6.1.0 /usr/lib/aarch64-linux-gnu/libgphoto2 /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27 /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/jl2005a.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/canon.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/lumix.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/ricoh_g3.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/ax203.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/sq905.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/sonix.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/docupen.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/mars.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/dimagev.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/digigr8.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/kodak_dc240.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/tp6801.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/directory.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/topfield.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/st2205.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/ptp2.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/sierra.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/pentax.so /usr/lib/aarch64-linux-gnu/libgphoto2/2.5.27/jl2005c.so /usr/lib/aarch64-linux-gnu/libgphoto2.so.6 /usr/lib/aarch64-linux-gnu/libgphoto2_port.so.12 /usr/lib/aarch64-linux-gnu/libgphoto2_port /usr/lib/aarch64-linux-gnu/libgphoto2_port/0.12.0 /usr/lib/aarch64-linux-gnu/libgphoto2_port/0.12.0/usbscsi.so /usr/lib/aarch64-linux-gnu/libgphoto2_port/0.12.0/serial.so /usr/lib/aarch64-linux-gnu/libgphoto2_port/0.12.0/disk.so /usr/lib/aarch64-linux-gnu/libgphoto2_port/0.12.0/ptpip.so /usr/lib/aarch64-linux-gnu/libgphoto2_port/0.12.0/usbdiskdirect.so /usr/lib/aarch64-linux-gnu/libgphoto2_port/0.12.0/usb1.so /usr/lib/udev/rules.d/60-libgphoto2-6.rules /usr/lib/udev/hwdb.d/20-libgphoto2-6.hwdb

3ricj commented 11 months ago

Ok, I got this sorted out.

sudo apt-get install libgphoto2-dev

.. was the answer. Perhaps a small update to the install docs would help the next person!

jim-easterbrook commented 11 months ago

You only needed the -dev library because you're compiling python-gphoto2 during installation. If you use the binary wheel from https://www.piwheels.org/project/gphoto2/ you don't need to compile. (And it installs a lot quicker.)

I should probably specify --only-binary :all: on the Pi command in README.rst though. Then you would have known you weren't doing a binary wheel installation.

In https://github.com/jim-easterbrook/python-gphoto2/blob/main/INSTALL.rst I wrote "Note that you need the "development headers" for libgphoto2 and Python."

3ricj commented 11 months ago

Thanks, yes, I was just following the directions to end up here. I think your proposed changes make this much better. Thank you!