arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation

Home Page:http://libtorrent.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error setting version of python binding when compiling

autogris opened this issue · comments

libtorrent version (or branch): 1.2.19

platform/architecture: linux Slackware64-current

compiler and compiler version: gcc 13.2.0, cmake 3.28.1, ninja 1.11.1, python 3.9.18

At the end of compilation process, when building the bindings apparently the version is wrongly set, here is the error:

running build
running build_py
creating /tmp/SBo/libtorrent-rasterbar-1.2.19/bindings/python/lib
copying /tmp/SBo/libtorrent-rasterbar-1.2.19/build/bindings/python/setup.py -> /tmp/SBo/libtorrent-rasterbar-1.2.19/bindings/python/lib
running egg_info
/usr/lib64/python3.9/site-packages/setuptools/command/egg_info.py:151: SetuptoolsDeprecationWarning: Invalid version: '0/tmp/SBo/libtorrent-rasterbar-1.2.19/bindings/python'.
!!
        ********************************************************************************
        Version '0/tmp/SBo/libtorrent-rasterbar-1.2.19/bindings/python' is not valid according to PEP 440.

        Please make sure to specify a valid version for your package.
        Also note that future releases of setuptools may halt the build process
        if an invalid version is given.

        This deprecation is overdue, please update your project and remove deprecated
        calls to avoid build errors in the future.

        See https://peps.python.org/pep-0440/ for details.
        ********************************************************************************
!!
  return _normalization.best_effort_version(f"0{self.vtags}")[1:]
/usr/lib64/python3.9/site-packages/setuptools/command/egg_info.py:131: SetuptoolsDeprecationWarning: Invalid version: '1.2.19/tmp/SBo/libtorrent-rasterbar-1.2.19/bindings/python'.
!!
        ********************************************************************************
        Version '1.2.19/tmp/SBo/libtorrent-rasterbar-1.2.19/bindings/python' is not valid according to PEP 440.

        Please make sure to specify a valid version for your package.
        Also note that future releases of setuptools may halt the build process
        if an invalid version is given.

        This deprecation is overdue, please update your project and remove deprecated
        calls to avoid build errors in the future.

        See https://peps.python.org/pep-0440/ for details.
        ********************************************************************************

!!
  return _normalization.best_effort_version(tagged)
Traceback (most recent call last):
  File "/tmp/SBo/libtorrent-rasterbar-1.2.19/build/bindings/python/setup.py", line 4, in <module>
    setup(
  File "/usr/lib64/python3.9/site-packages/setuptools/__init__.py", line 107, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/usr/lib64/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/lib64/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
    super().run_command(command)
  File "/usr/lib64/python3.9/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
    cmd_obj.ensure_finalized()
  File "/usr/lib64/python3.9/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
    self.finalize_options()
  File "/usr/lib64/python3.9/site-packages/setuptools/command/egg_info.py", line 219, in finalize_options
    parsed_version = packaging.version.Version(self.egg_version)
  File "/usr/lib64/python3.9/site-packages/setuptools/_vendor/packaging/version.py", line 197, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
setuptools.extern.packaging.version.InvalidVersion: Invalid version: '1.2.19-tmp-SBo-libtorrent-rasterbar-1.2.19-bindings-python'
make[2]: *** [bindings/python/CMakeFiles/python_bindings.dir/build.make:75: bindings/python/timestamp] Error 1
make[1]: *** [CMakeFiles/Makefile2:169: bindings/python/CMakeFiles/python_bindings.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I build it with the following parameters:

 cmake -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX="/usr" \
  -DCMAKE_INSTALL_LIBDIR="lib64" \
  -Dpython-bindings=ON \
  -Dboost-python-module-name="python3" \
  -Dpython-egg-info=ON \
  -GNinja ../
ninja

Apparently there was some problem on my system python setuptools, reinstalling it fixed the compilation problem. Sorry for the inconvenience.