BGT-M / spartan2

A collection of data mining algorithms on big graphs and time series
BSD 3-Clause "New" or "Revised" License
83 stars 19 forks source link

pip install spartan2 error #66

Open Zhuwenbopro opened 11 months ago

Zhuwenbopro commented 11 months ago

Collecting spartan2 Using cached spartan2-0.1.3.post4.tar.gz (183 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [6 lines of output] Traceback (most recent call last): File "", line 36, in File "", line 34, in File "C:\Users\11381\AppData\Local\Temp\pip-install-5t_ej234\spartan2_82ce834d43d44be19f5f75529d918a3e\setup.py", line 7, in from Cython.Build import cythonize, build_ext ModuleNotFoundError: No module named 'Cython' [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

这个是啥问题啊

HopeFan commented 9 months ago

Collecting spartan2 Using cached spartan2-0.1.3.post4.tar.gz (183 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [42 lines of output] C:\Users\ehesami\AppData\Local\anaconda3\envs\spartan\lib\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: C:\Users\ehesami\AppData\Local\Temp\pip-install-dxe2v491\spartan2_84579edc0b7543a0bf14dbbd39c8aeef\spartan\model\DPGS\c_MDL.pyx
tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      """
      Minimum encode length of n binary elements with k 1s and (n-k) 0s.
      """
      if n == 0 or k == 0 or k == n:
          return 0
      cpdef double x = -log2(<double> k / n);
            ^
  ------------------------------------------------------------

  spartan\model\DPGS\c_MDL.pyx:37:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
      Minimum encode length of n binary elements with k 1s and (n-k) 0s.
      """
      if n == 0 or k == 0 or k == n:
          return 0
      cpdef double x = -log2(<double> k / n);
      cpdef double y = -log2(<double> (n-k) / n);
            ^
  ------------------------------------------------------------

  spartan\model\DPGS\c_MDL.pyx:38:10: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.
  Traceback (most recent call last):
    File "<string>", line 36, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\ehesami\AppData\Local\Temp\pip-install-dxe2v491\spartan2_84579edc0b7543a0bf14dbbd39c8aeef\setup.py", line 50, in <module>
      ext_modules=cythonize(extensions),
    File "C:\Users\ehesami\AppData\Local\anaconda3\envs\spartan\lib\site-packages\Cython\Build\Dependencies.py", line 1154, in cythonize
      cythonize_one(*args)
    File "C:\Users\ehesami\AppData\Local\anaconda3\envs\spartan\lib\site-packages\Cython\Build\Dependencies.py", line 1321, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: spartan/model/DPGS/c_MDL.pyx
  Compiling spartan/model/DPGS/c_MDL.pyx because it changed.
  [1/1] Cythonizing spartan/model/DPGS/c_MDL.pyx
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

HopeFan commented 9 months ago

i am also getting this error

FengBotao119 commented 8 months ago

@HopeFan , have you solved this issue ? I encounter it as well .

oulenz commented 6 months ago

This appears to be a deprecation in Cython 3.0.0, and spartan2 should be updated to fix this.

In the mean time, I managed to fix this by installing Cython 0.29.36 instead. This in turn is incompatible with Python 3.11 and above, so I had to create a new environment with Python 3.10.