2

I am trying to install the gphoto2 library for Python on a Raspberry Pi B+ and I get this error:

pi@mazePi:~ $  pip install gphoto2

Collecting gphoto2
  Downloading https://files.pythonhosted.org/packages/fd/d7/7660013e81138c73232a62010d3d8816028d8a025d2e62c326dc07e9bb5f/gphoto2-1.8.2.tar.gz (7.2MB)
    100% |████████████████████████████████| 7.2MB 12kB/s 
    Complete output from command python setup.py egg_info:
    ERROR: command "pkg-config --modversion libgphoto2" failed
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-kqalDU/gphoto2/setup.py", line 38, in <module>
        cmd, stderr=FNULL, universal_newlines=True).split('.')
      File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['pkg-config', '--modversion', 'libgphoto2']' returned non-zero exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-kqalDU/gphoto2/

When running in verbose mode, I get:

Running setup.py (path:/tmp/pip-build-lLGQBj/gphoto2/setup.py) egg_info for package gphoto2
    Running command python setup.py egg_info
    ERROR: command "pkg-config --modversion libgphoto2" failed
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-lLGQBj/gphoto2/setup.py", line 38, in <module>
        cmd, stderr=FNULL, universal_newlines=True).split('.')
      File "/usr/lib/python2.7/subprocess.py", line 219, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['pkg-config', '--modversion', 'libgphoto2']' returned non-zero exit status 1
Cleaning up...
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-lLGQBj/gphoto2/
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in run
    wb.build(autobuilding=True)
  File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 634, in _prepare_file
    abstract_dist.prep_for_dist()
  File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 129, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python2.7/dist-packages/pip/utils/__init__.py", line 725, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-lLGQBj/gphoto2/

What is wrong?

8
  • What's the output of apt list pkg-config on your Pi?
    – Aurora0001
    May 5, 2018 at 14:08
  • pkg-config/stable,now 0.29-4 armhf [installed] May 5, 2018 at 14:37
  • Hmm, okay, so pkg-config is indeed installed. Try running pip install -v gphoto2 to see if the verbose output is helpful.
    – Aurora0001
    May 5, 2018 at 15:29
  • pastebin.com/gidFjGN3 May 5, 2018 at 17:51
  • Nothing particularly different there. Did you install the libgphoto2 headers? Check with apt list libgphoto2-dev - it should say [installed] if it is. (by the way, you can edit information into your question; no need to use Pastebin)
    – Aurora0001
    May 5, 2018 at 18:00

1 Answer 1

3

The line:

Command '['pkg-config', '--modversion', 'libgphoto2']' returned non-zero exit status 1

indicates something went wrong when the script tried to run pkg-config --modversion libgphoto2 on your system. As apt list libgphoto2-dev indicates that the headers are not installed (it doesn't say [installed] in the output), pkg-config fails to run properly when trying to link to libgphoto2. To install the headers, run:

sudo apt install libgphoto2-dev

This should resolve the issue and you should be able to re-run Pip successfully.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.