Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install spartan2 error #66

Open
Zhuwenbopro opened this issue Dec 14, 2023 · 4 comments
Open

pip install spartan2 error #66

Zhuwenbopro opened this issue Dec 14, 2023 · 4 comments

Comments

@Zhuwenbopro
Copy link

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
Copy link

HopeFan commented Feb 10, 2024

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
Copy link

HopeFan commented Feb 10, 2024

i am also getting this error

@FengBotao119
Copy link

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

@oulenz
Copy link

oulenz commented Apr 26, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants