wmayner / pyemd

Fast EMD for Python: a wrapper for Pele and Werman's C++ implementation of the Earth Mover's Distance metric
MIT License
479 stars 62 forks source link

python 3.11 support #59

Closed kPsarakis closed 1 year ago

kPsarakis commented 2 years ago

Hi! Thanks a lot for the project. Is there any plan to support python 3.11?

When I try to install the package there I get the following error:

Collecting pyemd
  Using cached pyemd-0.5.1.tar.gz (91 kB)
  Preparing metadata (setup.py) ... done
Collecting numpy<2.0.0,>=1.9.0
  Using cached numpy-1.23.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
Building wheels for collected packages: pyemd
  Building wheel for pyemd (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      /home/kyriakos/miniconda3/envs/valentine11/lib/python3.11/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/pyemd
      copying pyemd/__init__.py -> build/lib.linux-x86_64-cpython-311/pyemd
      copying pyemd/__about__.py -> build/lib.linux-x86_64-cpython-311/pyemd
      running build_ext
      building 'pyemd.emd' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/pyemd
      gcc -pthread -B /home/kyriakos/miniconda3/envs/valentine11/compiler_compat -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/kyriakos/miniconda3/envs/valentine11/include -fPIC -O2 -isystem /home/kyriakos/miniconda3/envs/valentine11/include -fPIC -I/home/kyriakos/miniconda3/envs/valentine11/include/python3.11 -I/tmp/pip-install-hch1ioh_/pyemd_850fda2363c24de38b5a817d08842ae6/.eggs/numpy-1.23.4-py3.11-linux-x86_64.egg/numpy/core/include -c pyemd/emd.cpp -o build/temp.linux-x86_64-cpython-311/pyemd/emd.o
      pyemd/emd.cpp:200:12: fatal error: longintrepr.h: No such file or directory
        200 |   #include "longintrepr.h"
            |            ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyemd
  Running setup.py clean for pyemd
Failed to build pyemd
Installing collected packages: numpy, pyemd
  Running setup.py install for pyemd ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pyemd did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      running install
      /home/kyriakos/miniconda3/envs/valentine11/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/pyemd
      copying pyemd/__init__.py -> build/lib.linux-x86_64-cpython-311/pyemd
      copying pyemd/__about__.py -> build/lib.linux-x86_64-cpython-311/pyemd
      running build_ext
      building 'pyemd.emd' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/pyemd
      gcc -pthread -B /home/kyriakos/miniconda3/envs/valentine11/compiler_compat -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/kyriakos/miniconda3/envs/valentine11/include -fPIC -O2 -isystem /home/kyriakos/miniconda3/envs/valentine11/include -fPIC -I/home/kyriakos/miniconda3/envs/valentine11/include/python3.11 -I/home/kyriakos/miniconda3/envs/valentine11/lib/python3.11/site-packages/numpy/core/include -c pyemd/emd.cpp -o build/temp.linux-x86_64-cpython-311/pyemd/emd.o
      pyemd/emd.cpp:200:12: fatal error: longintrepr.h: No such file or directory
        200 |   #include "longintrepr.h"
            |            ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyemd

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
mountain commented 1 year ago

I met same problem, and solved with below command

pip install cython

via https://github.com/aio-libs/aiohttp/issues/6600

wmayner commented 1 year ago

Python 3.11 is now supported in version 1.0.0 🎉