Open mascaretti opened 1 week ago
I have found a workaround: I am not sure all the passages are needed and not sure if it works on machine other than mine.
In order:
setuptools
Git/GitHub/DADApy/dadapy/_cython
python setup.py build_ext --inplace
and pip install .
in the relevant directory.This is the output of pip list
:
pip list
Package Version
--------------- -----------
contourpy 1.2.1
cycler 0.12.1
Cython 3.0.10
dadapy 0.3.0
fonttools 4.53.0
joblib 1.4.2
kiwisolver 1.4.5
matplotlib 3.9.0
numpy 1.26.4
packaging 24.1
pandas 2.2.2
pillow 10.3.0
pip 24.1
pyparsing 3.1.2
python-dateutil 2.9.0.post0
pytz 2024.1
scikit-learn 1.5.0
scipy 1.14.0
seaborn 0.13.2
setuptools 70.1.1
six 1.16.0
threadpoolctl 3.5.0
tzdata 2024.1
The version of Python is 3.12.4 and gcc is 14.1.1.
I run into troubles while cythonising (and following exactly the same instructions as above):
I do cython ./dadapy/_cython/*.pyx
and obtain
ython dadapy/_cython/*.pyx
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_clustering.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
DTYPE = np.int64
floatTYPE = np.float64
ctypedef np.int_t DTYPE_t
^
------------------------------------------------------------
dadapy/_cython/cython_clustering.pyx:16:9: 'int_t' is not a type identifier
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_clustering_v2.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
DTYPE = np.int64
floatTYPE = np.float64
ctypedef np.int_t DTYPE_t
^
------------------------------------------------------------
dadapy/_cython/cython_clustering_v2.pyx:15:9: 'int_t' is not a type identifier
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_density.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
DTYPE = np.int64
floatTYPE = np.float64
ctypedef np.int_t DTYPE_t
^
------------------------------------------------------------
dadapy/_cython/cython_density.pyx:16:9: 'int_t' is not a type identifier
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_differentiable_imbalance.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_distances.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
#DTYPE = int
#floatTYPE = np.float
#boolTYPE = np.bool
ctypedef np.int_t DTYPE_t
^
------------------------------------------------------------
dadapy/_cython/cython_distances.pyx:18:9: 'int_t' is not a type identifier
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_grads.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
DTYPE = np.int_
floatTYPE = np.float_
boolTYPE = np.bool_
ctypedef np.int_t DTYPE_t
^
------------------------------------------------------------
dadapy/_cython/cython_grads.pyx:12:9: 'int_t' is not a type identifier
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_maximum_likelihood_opt_full.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
DTYPE = np.int64
floatTYPE = np.float64
ctypedef np.int_t DTYPE_t
^
------------------------------------------------------------
dadapy/_cython/cython_maximum_likelihood_opt_full.pyx:13:9: 'int_t' is not a type identifier
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_maximum_likelihood_opt.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
DTYPE = np.int64
floatTYPE = np.float64
ctypedef np.int_t DTYPE_t
^
------------------------------------------------------------
dadapy/_cython/cython_maximum_likelihood_opt.pyx:13:9: 'int_t' is not a type identifier
/home/masca/.envs/ddp2/lib/python3.12/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: /home/masca/Git/GitHub/DADApy/dadapy/_cython/cython_overlap.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
Error compiling Cython file:
------------------------------------------------------------
...
cimport numpy as np
DTYPE = np.int64
floatTYPE = np.float64
ctypedef np.int_t DTYPE_t
^
------------------------------------------------------------
dadapy/_cython/cython_overlap.pyx:10:9: 'int_t' is not a type identifier
@mascaretti thank you very much for your feedback and your help in addressing the issue.
The problem was raised also in #131 and indeed it seems related to the new version of numpy. What I did not imagine is the fact that it all might simply be the np.int_t
missing type identifier in the new numpy. Along with @imacocco we will address this further!
Hi @mascaretti, as already written in #131, we found out this was a compatibility problem of cython with numpy 2.0. Thanks to @diegodoimo change in 6736b147fd4a5585d924a7e3ea12c44beb4e2763 we released version 0.3.1 which now you should be able to install correctly
Subject of the issue
Installation fails when working in a virtual environment. I have created a virtual environment using Mamba, then attempted to install using
pip
. Neitherpip install dadapy
norpip install git+https://github.com/sissa-data-science/DADApy
seems to work. The errors I get are due to Cython failing to compile.My environment
Steps to reproduce
Expected behaviour
Installation is successful.
Actual behaviour