jim-easterbrook/python-gphoto2

Problems installing on MacOS

MRossol opened this issue · 6 comments

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
python 3.7

What version of libgphoto2 have you installed?

How have you installed (or attempted to install) python-gphoto2?
pip install gphoto2
or
pip install gphoto2 --only-binary :all:

Your problem
pip is unable to install any of the current pypi packages, all attempts return the following error:

    ERROR: Command errored out with exit status 1:
     command: ~/miniconda3/envs/iot_hub/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t7/c77s7zy92zl351v3h1v884mh0000gq/T/pip-install-rjcf_swe/gphoto2_b558cff54b4f476b9aaee80cca95243c/setup.py'"'"'; __file__='"'"'/private/var/folders/t7/c77s7zy92zl351v3h1v884mh0000gq/T/pip-install-rjcf_swe/gphoto2_b558cff54b4f476b9aaee80cca95243c/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/t7/c77s7zy92zl351v3h1v884mh0000gq/T/pip-pip-egg-info-wp2z_196
         cwd: /private/var/folders/t7/c77s7zy92zl351v3h1v884mh0000gq/T/pip-install-rjcf_swe/gphoto2_b558cff54b4f476b9aaee80cca95243c/
    Complete output (10 lines):
    ERROR: command "pkg-config --modversion libgphoto2" failed
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/t7/c77s7zy92zl351v3h1v884mh0000gq/T/pip-install-rjcf_swe/gphoto2_b558cff54b4f476b9aaee80cca95243c/setup.py", line 36, in <module>
        cmd, stderr=FNULL, universal_newlines=True).split('.')[:3]
      File "~/miniconda3/envs/iot_hub/lib/python3.7/subprocess.py", line 411, in check_output
        **kwargs).stdout
      File "~/miniconda3/envs/iot_hub/lib/python3.7/subprocess.py", line 512, in run
        output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '['pkg-config', '--modversion', 'libgphoto2']' returned non-zero exit status 1.
    ----------------------------------------

As the error message says, the command pkg-config --modversion libgphoto2 failed. If you run this command directly you might find out why it's failing. The installer (when not installing a binary wheel) uses the output of pkg-config to determine which version of libgphoto2 you have so it can build from the correct set of sources.

Thanks for the quick response. Its unclear to me how/where to install libgphoto2 from?

It would help if you said what system you're using. On most Linux systems the easiest way to install libgphoto2 is with the operating system's package manager, and I believe that is also the case for MacOS. On Windows you're limited to using MSYS2.

I'm on a mac and was able to brew install gphoto2, is this the same as installing libgphoto2?

It would be very helpful to make your installation section more verbose with respect to the above.

I don't have a Mac. There are too many varieties of systems out there to provide detailed instructions for every one, and I can't write accurate instructions for systems I don't have anyway.

It is possible that installing gphoto2 with "brew" is all that's needed. Try the pkg-config command to find out. If you let me know what you need to install to get python-gphoto2 to install then I might be able to provide MacOS binary wheels in future.

I've had a go at building some binary wheels for MacOS. I've uploaded them to PyPI but have no idea if they work. @MRossol Please can you try installing one and let me know if it works for you.