Bergvca / string_grouper

Super Fast String Matching in Python
MIT License
364 stars 76 forks source link

sparse_dot_topn_for_blocks dependency broken with Cython 3.0 #93

Open alexiskaldany opened 1 year ago

alexiskaldany commented 1 year ago

error when install string-grouper generated by sparse_dot_topn_for_blocks dependency

ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel

  /tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/dist.py:509: InformationOnly: Normalizing '0.3.1-3' to '0.3.1.post3'
    self.metadata.version = self._normalize_version(
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-310
  creating build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/awesome_cossim_topn.py -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/__init__.py -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  running egg_info
  writing sparse_dot_topn_for_blocks.egg-info/PKG-INFO
  writing dependency_links to sparse_dot_topn_for_blocks.egg-info/dependency_links.txt
  writing requirements to sparse_dot_topn_for_blocks.egg-info/requires.txt
  writing top-level names to sparse_dot_topn_for_blocks.egg-info/top_level.txt
  reading manifest file 'sparse_dot_topn_for_blocks.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  adding license file 'LICENSE'
  writing manifest file 'sparse_dot_topn_for_blocks.egg-info/SOURCES.txt'
  copying sparse_dot_topn_for_blocks/array_wrappers.pxd -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/array_wrappers.pyx -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/sparse_dot_topn.pyx -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/sparse_dot_topn_parallel.cpp -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/sparse_dot_topn_parallel.h -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/sparse_dot_topn_source.cpp -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/sparse_dot_topn_source.h -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  copying sparse_dot_topn_for_blocks/sparse_dot_topn_threaded.pyx -> build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  running build_ext
  /tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/tmpaqn4vovk/sparse_dot_topn_for_blocks-0.3.1.post3/sparse_dot_topn_for_blocks/array_wrappers.pxd
    tree = Parsing.p_module(s, pxd, full_module_name)
  Compiling ./sparse_dot_topn_for_blocks/array_wrappers.pyx because it changed.
  [1/1] Cythonizing ./sparse_dot_topn_for_blocks/array_wrappers.pyx
  building 'sparse_dot_topn_for_blocks.array_wrappers' extension
  creating build/temp.linux-x86_64-cpython-310
  creating build/temp.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/tmpx4q1lfox/.venv/include -I/usr/local/include/python3.10 -I/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/numpy/core/include -c ./sparse_dot_topn_for_blocks/array_wrappers.cpp -o build/temp.linux-x86_64-cpython-310/./sparse_dot_topn_for_blocks/array_wrappers.o -std=c++0x -pthread -O3
  g++ -shared build/temp.linux-x86_64-cpython-310/./sparse_dot_topn_for_blocks/array_wrappers.o -L/usr/local/lib -o build/lib.linux-x86_64-cpython-310/sparse_dot_topn_for_blocks/array_wrappers.cpython-310-x86_64-linux-gnu.so
  /tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/tmpaqn4vovk/sparse_dot_topn_for_blocks-0.3.1.post3/sparse_dot_topn_for_blocks/sparse_dot_topn.pyx
    tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # April 14, 2021

  # distutils: language = c++

  from libcpp.vector cimport vector
  from array_wrappers cimport ArrayWrapper_int, ArrayWrapper_float, ArrayWrapper_double
  ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:23:0: 'array_wrappers.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # April 14, 2021

  # distutils: language = c++

  from libcpp.vector cimport vector
  from array_wrappers cimport ArrayWrapper_int, ArrayWrapper_float, ArrayWrapper_double
  ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:23:0: 'array_wrappers/ArrayWrapper_int.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # April 14, 2021

  # distutils: language = c++

  from libcpp.vector cimport vector
  from array_wrappers cimport ArrayWrapper_int, ArrayWrapper_float, ArrayWrapper_double
  ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:23:0: 'array_wrappers/ArrayWrapper_float.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  # April 14, 2021

  # distutils: language = c++

  from libcpp.vector cimport vector
  from array_wrappers cimport ArrayWrapper_int, ArrayWrapper_float, ArrayWrapper_double
  ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:23:0: 'array_wrappers/ArrayWrapper_double.pxd' not found

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
    ) except +;

  cpdef ArrayWrapper_template(vector[float_ft] vCx):
    # raise Exception("In sparse_dot_topn.pyx")
    if float_ft is float:
        return ArrayWrapper_float(vCx)
           ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:116:9: 'ArrayWrapper_float' is not a constant, variable or function identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  cpdef ArrayWrapper_template(vector[float_ft] vCx):
    # raise Exception("In sparse_dot_topn.pyx")
    if float_ft is float:
        return ArrayWrapper_float(vCx)
    elif float_ft is double:
        return ArrayWrapper_double(vCx)
           ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:118:9: 'ArrayWrapper_double' is not a constant, variable or function identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

    if nnz_max_is_too_small:

        # raise Exception("In sparse_dot_topn.pyx")

        c_indices = np.asarray(ArrayWrapper_int(vCj)).squeeze(axis=0)
                           ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:209:25: 'ArrayWrapper_int' is not a constant, variable or function identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

    if nnz_max_is_too_small:

        # raise Exception("In sparse_dot_topn.pyx")

        c_indices = np.asarray(ArrayWrapper_int(vCj)).squeeze(axis=0)
                           ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:209:25: 'ArrayWrapper_int' is not a constant, variable or function identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

    if nnz_max_is_too_small:

        # raise Exception("In sparse_dot_topn.pyx")

        c_indices = np.asarray(ArrayWrapper_int(vCj)).squeeze(axis=0)
                           ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:296:25: 'ArrayWrapper_int' is not a constant, variable or function identifier

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

    if nnz_max_is_too_small:

        # raise Exception("In sparse_dot_topn.pyx")

        c_indices = np.asarray(ArrayWrapper_int(vCj)).squeeze(axis=0)
                           ^
  ------------------------------------------------------------

  sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:296:25: 'ArrayWrapper_int' is not a constant, variable or function identifier
  Compiling ./sparse_dot_topn_for_blocks/sparse_dot_topn.pyx because it changed.
  [1/1] Cythonizing ./sparse_dot_topn_for_blocks/sparse_dot_topn.pyx
  Traceback (most recent call last):
    File "/usr/local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/usr/local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 416, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 65, in <module>
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
      return distutils.core.setup(**attrs)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
      super().run_command(command)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 343, in run
      self.run_command("build")
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
      super().run_command(command)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
      self.run_command(cmd_name)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
      super().run_command(command)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
      _build_ext.run(self)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
      self.build_extensions()
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
      self._build_extensions_serial()
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
      self.build_extension(ext)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
      _build_ext.build_extension(self, ext)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 122, in build_extension
      new_ext = cythonize(
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
      cythonize_one(*args)
    File "/tmp/tmpx4q1lfox/.venv/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: ./sparse_dot_topn_for_blocks/sparse_dot_topn.pyx

  at /usr/local/lib/python3.10/site-packages/poetry/installation/chef.py:147 in _prepare
      143│ 
      144│                 error = ChefBuildError("\n\n".join(message_parts))
      145│ 
      146│             if error is not None:
    → 147│                 raise error from None
      148│ 
      149│             return path
      150│ 
      151│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with sparse-dot-topn-for-blocks (0.3.1.post3) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "sparse-dot-topn-for-blocks (==0.3.1.post3)"'.
adityat commented 1 year ago

Having same issue

Following

MahireAsadzade commented 1 year ago

I face the same issue as well

varun-affinsys commented 1 year ago

This error is coming while installing string_grouper==0.6.1, in python 3.9

ethanfan19 commented 1 year ago

Same issue here with python 3.9.13 and latest numpy, scipy packges

jdh208 commented 1 year ago

Same issue here with Python 3.11.4, NumPy 1.25.1, SciPy 1.11.1

Edit: @kykyi had a workable solution

pip install cython==0.29.36 numpy pip install sparse_dot_topn_for_blocks --no-build-isolation

kykyi commented 1 year ago

Unsure if the maintainers of sparse_dot_topn_for_blocks are still on the project, this PR has been open for 2 weeks 😞: https://github.com/ParticularMiner/sparse_dot_topn_for_blocks/pull/4

AlejandroUPC commented 1 year ago

@kykyi Is this repo also inactive, or? Also affected by this

kykyi commented 1 year ago

I think it is both inactive and affected by this @AlejandroUPC 😞