jim-easterbrook / python-gphoto2

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

Can't build with Python 3.8 #110

Closed ramdroid closed 3 years ago

ramdroid commented 3 years ago

running install running build running build_py creating build creating build/lib.macosx-10.14.6-x86_64-3.8 creating build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/filesys.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/widget.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/version.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/list.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/__init__.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/result.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/camera.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/file.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/context.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/abilities_list.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/port_info_list.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 copying src/swig-bi-py3-gp2.5/port_log.py -> build/lib.macosx-10.14.6-x86_64-3.8/gphoto2 running build_ext building '_port_info_list' extension creating build/temp.macosx-10.14.6-x86_64-3.8 creating build/temp.macosx-10.14.6-x86_64-3.8/src creating build/temp.macosx-10.14.6-x86_64-3.8/src/swig-bi-py3-gp2.5 xcrun -sdk macosx clang -arch arm64 -arch x86_64 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -I/usr/local/Cellar/libgphoto2/2.5.26/include -I/Users/rammann/fiegl-abv/hw-webservice/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c src/swig-bi-py3-gp2.5/port_info_list_wrap.c -o build/temp.macosx-10.14.6-x86_64-3.8/src/swig-bi-py3-gp2.5/port_info_list_wrap.o -O3 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-label -Wno-strict-prototypes -DGPHOTO2_VERSION=0x02051a warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option] src/swig-bi-py3-gp2.5/port_info_list_wrap.c:3096:3: error: implicit declaration of function '_PyObject_GC_UNTRACK' is invalid in C99 [-Werror,-Wimplicit-function-declaration] _PyObject_GC_UNTRACK(descr); ^ 1 warning and 1 error generated. error: command 'xcrun' failed with exit status 1

_PyObject_GC_UNTRACK has been removed in Python 3.8:

https://docs.python.org/3/whatsnew/changelog.html https://bugs.python.org/issue35081

jim-easterbrook commented 3 years ago

Python 3.8 support was added to SWIG with version 4.0.1, but I'm still using 3.0.12 to generate python-gphoto2 releases. (It's the default for openSUSE 15.1, which is what my main machine is running. I guess it's time I upgraded to 15.2.)

If you can run SWIG yourself you might have more luck. Meanwhile I'll try and get a new release out within the next week or so.

jim-easterbrook commented 3 years ago

I've installed SWIG 4.0.2 on my current setup and it seems to work OK. Release 2.2.4 has been compiled with it so should support Python 3.8.

ramdroid commented 3 years ago

Great, works for me! Thanks for the quick fix!

ujjwalk450 commented 3 years ago

Doesnt work for me with pip, setup.py or even swig version 4

jim-easterbrook commented 3 years ago

Which SWIG version exactly? What operating system? What error messages?

ujjwalk450 commented 3 years ago

OS is Ubuntu 20.04

This is the error with pip

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 357, in run
    resolver.resolve(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 515, in prepare_linked_requirement
    abstract_dist = _get_prepared_distribution(
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/usr/lib/python3/dist-packages/pip/_internal/distributions/sdist.py", line 40, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 564, in prepare_metadata
    self.metadata_directory = self._generate_metadata()
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 538, in _generate_metadata
    return generate_metadata_legacy(
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/build/metadata_legacy.py", line 115, in generate_metadata
    call_subprocess(
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ujjwal@ujjwal-HP-ENVY-x360-Convertible-13-ag0xxx:~$ 
ujjwalk450 commented 3 years ago

this error is with setup.py

ujjwal@ujjwal-HP-ENVY-x360-Convertible-13-ag0xxx:/Desktop/python-gphoto2$ sudo python3 setup.py ERROR: command "pkg-config --modversion libgphoto2" failed Traceback (most recent call last): File "setup.py", line 35, in gphoto2_version = subprocess.check_output( File "/usr/lib/python3.8/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 512, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['pkg-config', '--modversion', 'libgphoto2']' returned non-zero exit status 1. ujjwal@ujjwal-HP-ENVY-x360-Convertible-13-ag0xxx:/Desktop/python-gphoto2$

ujjwalk450 commented 3 years ago

this is with SWIG Version 4.0.1

ujjwal@ujjwal-HP-ENVY-x360-Convertible-13-ag0xxx:/Desktop/python-gphoto2$ sudo python3 setup.py build_swig ERROR: command "pkg-config --modversion libgphoto2" failed Traceback (most recent call last): File "setup.py", line 35, in gphoto2_version = subprocess.check_output( File "/usr/lib/python3.8/subprocess.py", line 411, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.8/subprocess.py", line 512, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['pkg-config', '--modversion', 'libgphoto2']' returned non-zero exit status 1. ujjwal@ujjwal-HP-ENVY-x360-Convertible-13-ag0xxx:/Desktop/python-gphoto2$

jim-easterbrook commented 3 years ago

The pkg-config --modversion libgphoto2 command fails when you haven't installed the development headers for libgphoto2. The exact package name depends on your operating system. The pip error is unhelpful, as they usually are. Using the -v option with pip will generate a lot more output, some of which might be useful.