calvin-sykes / cython_parallel_sort

Cython interface to C++ parallel sorting routines
MIT License
5 stars 0 forks source link

Python 3.12 installation problem #3

Open s-a-nersisyan opened 1 day ago

s-a-nersisyan commented 1 day ago

Hi Calvin,

Thanks a lot for making this package, I'm currently making an app that actively uses it.

One problem I found today is that pip install parallel_sort doesn't work with Python 3.12 or higher (it works on the same machine with Python 3.9, 3.10, and 3.11; in each case I used a clean conda environment). Here is the error message with 3.12:

Collecting parallel_sort
  Downloading parallel-sort-0.2.0.tar.gz (196 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting numpy (from parallel_sort)
  Downloading numpy-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (62 kB)
Downloading numpy-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.0 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.0/16.0 MB 56.6 MB/s eta 0:00:00
Building wheels for collected packages: parallel_sort
  Building wheel for parallel_sort (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for parallel_sort (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [77 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build/lib.linux-x86_64-cpython-312/parallel_sort
      copying parallel_sort/__init__.py -> build/lib.linux-x86_64-cpython-312/parallel_sort
      copying parallel_sort/_version.py -> build/lib.linux-x86_64-cpython-312/parallel_sort
      creating build/lib.linux-x86_64-cpython-312/parallel_sort/tests
      copying parallel_sort/tests/__init__.py -> build/lib.linux-x86_64-cpython-312/parallel_sort/tests
      copying parallel_sort/tests/test_sorting.py -> build/lib.linux-x86_64-cpython-312/parallel_sort/tests
      running egg_info
      writing parallel_sort.egg-info/PKG-INFO
      writing dependency_links to parallel_sort.egg-info/dependency_links.txt
      writing requirements to parallel_sort.egg-info/requires.txt
      writing top-level names to parallel_sort.egg-info/top_level.txt
      ERROR setuptools_scm._file_finders.git listing git files failed - pretending there aren't any
      reading manifest file 'parallel_sort.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'parallel_sort/parallel_sort.pyx'
      warning: no files found matching 'parallel_sort/parallel_sort.hpp'
      warning: no files found matching 'parallel_sort/parallel_sort.cpp'
      adding license file 'LICENSE'
      writing manifest file 'parallel_sort.egg-info/SOURCES.txt'
      /tmp/pip-build-env-hjz6m4l0/overlay/lib/python3.12/site-packages/setuptools/command/build_py.py:219: _Warning: Package 'parallel_sort.src' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'parallel_sort.src' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'parallel_sort.src' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'parallel_sort.src' to be distributed and are
              already explicitly excluding 'parallel_sort.src' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      creating build/lib.linux-x86_64-cpython-312/parallel_sort/src
      copying parallel_sort/src/parallel_sort.cpp -> build/lib.linux-x86_64-cpython-312/parallel_sort/src
      copying parallel_sort/src/parallel_sort.hpp -> build/lib.linux-x86_64-cpython-312/parallel_sort/src
      copying parallel_sort/src/parallel_sort.pyx -> build/lib.linux-x86_64-cpython-312/parallel_sort/src
      running build_ext
      building 'parallel_sort.extension' extension
      creating build/temp.linux-x86_64-cpython-312/parallel_sort/src
      g++ -pthread -B /oceanus/users/sxn370/software/miniconda3/envs/test12/compiler_compat -fno-strict-overflow -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /oceanus/users/sxn370/software/miniconda3/envs/test12/include -fPIC -O2 -isystem /oceanus/users/sxn370/software/miniconda3/envs/test12/include -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -Iparallel_sort/src -I/tmp/pip-build-env-hjz6m4l0/overlay/lib/python3.12/site-packages/numpy/_core/include -I/oceanus/users/sxn370/software/miniconda3/envs/test12/include/python3.12 -c parallel_sort/src/parallel_sort.cpp -o build/temp.linux-x86_64-cpython-312/parallel_sort/src/parallel_sort.o -std=c++17
      In file included from parallel_sort/src/parallel_sort.cpp:1287:
      parallel_sort/src/parallel_sort.hpp:6:10: fatal error: execution: No such file or directory
       #include <execution>
                ^~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/g++' 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 parallel_sort
Failed to build parallel_sort
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (parallel_sort)
calvin-sykes commented 6 hours ago

I'm glad it's useful! And thanks for the report, I think the actual problem here was just that I wasn't building wheels (binary packages) for python3.12, and your system isn't set up to be able to compile from source. Based on the error message, your compiler and/or libstdc++ are too old to have the <execution> header, which is part of the C++17 standard and is what the module relies on.

I've published a new release which adds the missing binaries, and also fixes the macOS-specific problems from your other issues - thanks for reporting those as well.