ParticularMiner / sparse_dot_topn_for_blocks

It has the same interface as `sparse_dot_topn` but additionally allows an array to be passed which will be updated with the maximum number of nonzero elements of each row of the result matrix with values above the given lower bound. This is suitable for block-matrix multiplication. That's all!
Apache License 2.0
0 stars 9 forks source link

Failure to build wheel #3

Open footballanalyticscffc opened 1 year ago

footballanalyticscffc commented 1 year ago

Hello,

We are having a bizarre issue (that seemingly started randomly) when attempting to build in a GitHub action.

Here's the error log:

Pip subprocess error:
  error: subprocess-exited-with-error

  × Building wheel for sparse-dot-topn-for-blocks (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [240 lines of output]
      /tmp/pip-build-env-7j76aogf/overlay/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/pip-build-env-7j76aogf/normal/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/pip-install-d4danfp3/sparse-dot-topn-for-blocks_6880d0792a4e4b88820f21f5f53b189e/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 -pthread -B /usr/share/miniconda3/envs/cffc-api/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /usr/share/miniconda3/envs/cffc-api/include -fPIC -O2 -isystem /usr/share/miniconda3/envs/cffc-api/include -fPIC -I/usr/share/miniconda3/envs/cffc-api/include/python3.10 -I/tmp/pip-build-env-7j76aogf/normal/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++ -pthread -B /usr/share/miniconda3/envs/cffc-api/compiler_compat -shared -Wl,--allow-shlib-undefined -Wl,-rpath,/usr/share/miniconda3/envs/cffc-api/lib -Wl,-rpath-link,/usr/share/miniconda3/envs/cffc-api/lib -L/usr/share/miniconda

Any help appreciated!

footballanalyticscffc commented 1 year ago

Here's the exception I am seeing:

        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)
footballanalyticscffc commented 1 year ago

This may also be helpful:

/tmp/pip-build-env-g_cqe0kc/normal/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/pip-install-7t4ovcxf/sparse-dot-topn-for-blocks_8280299356da4f999a9a1f1d99e10cb7/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
DanielWozniak94 commented 1 year ago

Started to see this in the past few days as well. If it helps here is the stacktrace

     sparse_dot_topn_for_blocks/sparse_dot_topn.pyx:296:25: 'ArrayWrapper_int' is not a constant, variable or function identifier
      Traceback (most recent call last):
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.10/site-packages/pip/_vendor/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/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-30n48vpk/overlay/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/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-30n48vpk/overlay/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/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-build-env-30n48vpk/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
          _build_ext.build_extension(self, ext)
        File "/tmp/pip-build-env-30n48vpk/normal/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 122, in build_extension
          new_ext = cythonize(
        File "/tmp/pip-build-env-30n48vpk/normal/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-30n48vpk/normal/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
mattotodd commented 1 year ago

I believe this is related to Cython 3.0 being released yesterday. I'm hitting the issue too

  • Installing sparse-dot-topn-for-blocks (0.3.1.post3): Failed

  CalledProcessError

  Command '['/Users/mattotodd/Library/Caches/pypoetry/virtualenvs/pliable-zOVad83R-py3.11/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/Users/mattotodd/Library/Caches/pypoetry/virtualenvs/pliable-zOVad83R-py3.11', '--no-deps', '/Users/mattotodd/Library/Caches/pypoetry/artifacts/bc/8f/34/c05af466a341c7e464d8de59334dfedd1092371042df30563bd2365c7c/sparse_dot_topn_for_blocks-0.3.1.post3.tar.gz']' returned non-zero exit status 1.

  at ~/.pyenv/versions/3.10.10/lib/python3.10/subprocess.py:526 in run
       522│             # We don't call process.wait() as .__exit__ does that for us.
       523│             raise
       524│         retcode = process.poll()
       525│         if check and retcode:
    →  526│             raise CalledProcessError(retcode, process.args,
       527│                                      output=stdout, stderr=stderr)
       528│     return CompletedProcess(process.args, retcode, stdout, stderr)
       529│ 
       530│ 

The following error occurred when trying to handle this error:

  EnvCommandError

  Command ['/Users/mattotodd/Library/Caches/pypoetry/virtualenvs/pliable-zOVad83R-py3.11/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/Users/mattotodd/Library/Caches/pypoetry/virtualenvs/pliable-zOVad83R-py3.11', '--no-deps', '/Users/mattotodd/Library/Caches/pypoetry/artifacts/bc/8f/34/c05af466a341c7e464d8de59334dfedd1092371042df30563bd2365c7c/sparse_dot_topn_for_blocks-0.3.1.post3.tar.gz'] errored with the following return code 1, and output: 
  Processing /Users/mattotodd/Library/Caches/pypoetry/artifacts/bc/8f/34/c05af466a341c7e464d8de59334dfedd1092371042df30563bd2365c7c/sparse_dot_topn_for_blocks-0.3.1.post3.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Installing backend dependencies: started
    Installing backend dependencies: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  Building wheels for collected packages: sparse-dot-topn-for-blocks
    Building wheel for sparse-dot-topn-for-blocks (pyproject.toml): started
    Building wheel for sparse-dot-topn-for-blocks (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error

    × Building wheel for sparse-dot-topn-for-blocks (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [246 lines of output]
        /private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/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.macosx-12.0-arm64-cpython-311
        creating build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/__init__.py -> build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/awesome_cossim_topn.py -> build/lib.macosx-12.0-arm64-cpython-311/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.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/array_wrappers.pyx -> build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/sparse_dot_topn.pyx -> build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/sparse_dot_topn_parallel.cpp -> build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/sparse_dot_topn_parallel.h -> build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/sparse_dot_topn_source.cpp -> build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/sparse_dot_topn_source.h -> build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        copying sparse_dot_topn_for_blocks/sparse_dot_topn_threaded.pyx -> build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        running build_ext
        /private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/normal/lib/python3.11/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: /private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-req-build-f334u17x/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.macosx-12.0-arm64-cpython-311
        creating build/temp.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks
        clang -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/mattotodd/Library/Caches/pypoetry/virtualenvs/pliable-zOVad83R-py3.11/include -I/Users/mattotodd/.pyenv/versions/3.11.2/include/python3.11 -I/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/normal/lib/python3.11/site-packages/numpy/core/include -c ./sparse_dot_topn_for_blocks/array_wrappers.cpp -o build/temp.macosx-12.0-arm64-cpython-311/./sparse_dot_topn_for_blocks/array_wrappers.o -std=c++0x -pthread -O3
        clang++ -bundle -undefined dynamic_lookup -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/mattotodd/.pyenv/versions/3.11.2/lib -Wl,-rpath,/Users/mattotodd/.pyenv/versions/3.11.2/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -L/opt/homebrew/opt/readline/lib -L/opt/homebrew/opt/readline/lib -L/Users/mattotodd/.pyenv/versions/3.11.2/lib -Wl,-rpath,/Users/mattotodd/.pyenv/versions/3.11.2/lib -L/opt/homebrew/lib -Wl,-rpath,/opt/homebrew/lib -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib build/temp.macosx-12.0-arm64-cpython-311/./sparse_dot_topn_for_blocks/array_wrappers.o -L/Users/mattotodd/.pyenv/versions/3.11.2/lib -o build/lib.macosx-12.0-arm64-cpython-311/sparse_dot_topn_for_blocks/array_wrappers.cpython-311-darwin.so
        /private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/normal/lib/python3.11/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: /private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-req-build-f334u17x/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 "/Users/mattotodd/Library/Caches/pypoetry/virtualenvs/pliable-zOVad83R-py3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
            main()
          File "/Users/mattotodd/Library/Caches/pypoetry/virtualenvs/pliable-zOVad83R-py3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/Users/mattotodd/Library/Caches/pypoetry/virtualenvs/pliable-zOVad83R-py3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
            return _build_backend().build_wheel(wheel_directory, config_settings,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 416, in build_wheel
            return self._build_with_temp_dir(['bdist_wheel'], '.whl',
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
            self.run_setup()
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup
            exec(code, locals())
          File "<string>", line 65, in <module>
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
            return distutils.core.setup(**attrs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
            return run_commands(dist)
                   ^^^^^^^^^^^^^^^^^^
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
            dist.run_commands()
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
            self.run_command(cmd)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
            super().run_command(command)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
            cmd_obj.run()
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 343, in run
            self.run_command("build")
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
            self.distribution.run_command(command)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
            super().run_command(command)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
            cmd_obj.run()
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
            self.run_command(cmd_name)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
            self.distribution.run_command(command)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
            super().run_command(command)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
            cmd_obj.run()
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
            _build_ext.run(self)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
            self.build_extensions()
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
            self._build_extensions_serial()
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
            self.build_extension(ext)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
            _build_ext.build_extension(self, ext)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/normal/lib/python3.11/site-packages/Cython/Distutils/build_ext.py", line 122, in build_extension
            new_ext = cythonize(
                      ^^^^^^^^^^
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/normal/lib/python3.11/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
            cythonize_one(*args)
          File "/private/var/folders/cg/gk_xvzfn6jn7v6bzpvydqc040000gn/T/pip-build-env-k7i8zmaj/normal/lib/python3.11/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
        [end of output]
johannesboyne commented 1 year ago

Hotfixing is possible by using another pypi mirror for the package currently. Even though, this is not a long-term solution: A possible mirror is. --index-url https://mirrors.sustech.edu.cn/pypi/simple

janithpet commented 1 year ago

For me, the temporary fix from here worked too:

https://github.com/ing-bank/sparse_dot_topn/issues/84#issuecomment-1641277526

That is, install cython==0.29.36 and numpy, then install this package with --no-build-isolation:

pip install cython==0.29.36 numpy
pip install sparse_dot_topn_for_blocks --no-build-isolation
JarekParal commented 1 year ago

I found another workaround here:

echo "Cython==0.29.35" >> constraints.txt
export PIP_CONSTRAINT="$(pwd)/constraints.txt"

or you can add a link to constraints.txt to your requirements.txt:

--constraint constraints.txt
anyio==3.6.1
...

In both cases, the constraint is applied for dependent packages of packages used in requirements.txt