epigenelabs / inmoose

InMoose is the INtegrated Multi Omic Open Source Environment. It is a collection of tools for the analysis of omic data.
GNU General Public License v3.0
49 stars 5 forks source link

Compilation error w/ gcc for early versions of inmoose #70

Open XikunZhang opened 2 months ago

XikunZhang commented 2 months ago

Hi!

First of all, thank you so much for creating this tool. It has been super useful for my research and I have been using it a lot!

I am encountering an error when trying to pip install some early version of inmoose (e.g. version 0.2.3). I can install the latest versions, but I am specifically interested in working with some early versions. My operating system is CentOS Linux 7 and I am using python 3.11.9. I have tried many different gcc versions from 4.8.5 to 12.1.0 and the error persists. Here is the error message:

      gcc -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/groups/emmalu/xikunz2/miniconda3/envs/r42/include -fPIC -O2 -isys
tem /home/groups/emmalu/xikunz2/miniconda3/envs/r42/include -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -I/tmp/pip-build-
env-al50sqa5/overlay/lib/python3.11/site-packages/numpy/_core/include -I/home/groups/emmalu/xikunz2/miniconda3/envs/r42/include
/python3.11 -c inmoose/common_cpp/matrix.cpp -o build/temp.linux-x86_64-cpython-311/inmoose/common_cpp/matrix.o -std=c++17
      inmoose/common_cpp/matrix.cpp: In lambda function:
      inmoose/common_cpp/matrix.cpp:26:7: warning: converting to non-pointer type ‘long int’ from NULL [-Wconversion-null]
         26 |       import_array();
            |       ^~~~~~~~~~~~
      inmoose/common_cpp/matrix.cpp:28:12: warning: converting to non-pointer type ‘long int’ from NULL [-Wconversion-null]
         28 |     return NULL;
            |            ^~~~
      inmoose/common_cpp/matrix.cpp: In destructor ‘Matrix<T>::~Matrix()’:
      inmoose/common_cpp/matrix.cpp:78:44: error: there are no arguments to ‘PyArray_REFCOUNT’ that depend on a template parame
ter, so a declaration of ‘PyArray_REFCOUNT’ must be available [-fpermissive]
         78 |     std::cerr << "[MATRIX] refcount = " << PyArray_REFCOUNT(obj) << std::endl;
            |                                            ^~~~~~~~~~~~~~~~
      inmoose/common_cpp/matrix.cpp:78:44: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of
 an undeclared name is deprecated)
      inmoose/common_cpp/matrix.cpp: In instantiation of ‘Matrix<T>::~Matrix() [with T = double]’:
      inmoose/common_cpp/matrix.cpp:149:16:   required from here
      inmoose/common_cpp/matrix.cpp:78:60: error: ‘PyArray_REFCOUNT’ was not declared in this scope; did you mean ‘PyArray_ISFL
OAT’?
         78 |     std::cerr << "[MATRIX] refcount = " << PyArray_REFCOUNT(obj) << std::endl;
            |                                            ~~~~~~~~~~~~~~~~^~~~~
            |                                            PyArray_ISFLOAT
      inmoose/common_cpp/matrix.cpp: In instantiation of ‘Matrix<T>::~Matrix() [with T = long int]’:
      inmoose/common_cpp/matrix.cpp:150:16:   required from here
      inmoose/common_cpp/matrix.cpp:78:60: error: ‘PyArray_REFCOUNT’ was not declared in this scope; did you mean ‘PyArray_ISFL
OAT’?
         78 |     std::cerr << "[MATRIX] refcount = " << PyArray_REFCOUNT(obj) << std::endl;
            |                                            ~~~~~~~~~~~~~~~~^~~~~
            |                                            PyArray_ISFLOAT
      error: command '/share/software/user/open/gcc/12.1.0/bin/gcc' failed with exit code 1
      [end of output]

Any help would be appreciated! Thanks a lot in advance!

EpigeneMax commented 1 month ago

Hello @XikunZhang ! Thank you for using inmoose and for your valuable feedback.

I'm getting back to inmoose after summer holiday.

What version of numpy are you using? The recent 2.0.0 version, released in June, impacts the C API. My first guess would be to replace PyArray_REFCOUNT with Py_REFCNT, as shown in 97268ef. Erring on a safer side, you can also force an older version of numpy at compilation, by updating pyproject.toml. In the [build-system] section, update the requires = ... line to: requires = ["setuptools", "numpy<2.0.0", "scipy", "Cython>=3.0.0", "wheel"]

Please let us know if it solves your issue!

I'm also curious about why you are interested in older versions of inmoose: it sounds like we may have missed some use cases.