lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
229 stars 285 forks source link

Error during CLASS wrapper installation: 'int_t' not recognized in Cython file classy.pyx (Python 3.10) #599

Open rafaglz01 opened 1 week ago

rafaglz01 commented 1 week ago

Hi, i'm having problems installing the class wrapper, i get the following error:

(env_py310) rafael@rafael-ASUS-TUF-Gaming-A15-FA506IV-FA506IV:~/Documentos/class_public-3.2.3/python$ python3.10 setup.py build_ext --inplace -vv
/home/rafael/Documentos/class_public-3.2.3/python/setup.py:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.core import setup
running build_ext
Compiling /home/rafael/Documentos/class_public-3.2.3/python/../python/classy.pyx because it changed.
[1/1] Cythonizing /home/rafael/Documentos/class_public-3.2.3/python/../python/classy.pyx

Error compiling Cython file:
------------------------------------------------------------
...
        return d.items()
    else:
        return d.viewitems()

ctypedef np.float_t DTYPE_t
ctypedef np.int_t DTYPE_i
         ^
------------------------------------------------------------

classy.pyx:35:9: 'int_t' is not a type identifier
warning: classy.pyx:363:76: local variable 'errmsg' referenced before assignment
warning: classy.pyx:364:39: local variable 'errmsg' referenced before assignment
Traceback (most recent call last):
  File "/home/rafael/Documentos/class_public-3.2.3/python/setup.py", line 56, in <module>
    setup(
  File "/home/rafael/env_py310/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.10/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/usr/lib/python3.10/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib/python3.10/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/rafael/env_py310/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 130, in build_extension
    new_ext = cythonize(
  File "/home/rafael/env_py310/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
    cythonize_one(*args)
  File "/home/rafael/env_py310/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: 

 `/home/rafael/Documentos/class_public-3.2.3/python/../python/classy.pyx

Furthermore, i'm using a virtual environment for Python3.10. I guess this is an issue with the Cython version, but i'm not sure, could you please help me solving this problem?

borisbolliet commented 1 week ago

Hi, I think you can solve this issue with this solution: https://github.com/lesgourg/class_public/issues/584#issuecomment-2309357962