DynamicsAndNeuralSystems / pycatch22

python implementation of catch22
https://time-series-features.gitbook.io/catch22/python
GNU General Public License v3.0
75 stars 15 forks source link

Failure to build wheels on RHEL 64 cluster system #5

Closed jbteves closed 1 year ago

jbteves commented 1 year ago

Hello, a colleague of mine (@meganspurney) tried to pip install this in a valid conda environment on our cluster, an RHEL 64-bit system, and unfortunately got some errors. I believe from the errors there needs to be some configuration of the wheel building system to force C99 mode for GCC compilers. On the other hand, this works fine on MacOS systems (which use clang, which is generally less picky about these things).

(winter2022) [spurneyma@cn2880 pycatch22]$ pip install pycatch22
Collecting pycatch22
 Using cached pycatch22-0.4.2.tar.gz (49 kB)
 Installing build dependencies ... done
 Getting requirements to build wheel ... done
 Installing backend dependencies ... done
 Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pycatch22
 Building wheel for pycatch22 (pyproject.toml) ... error
 error: subprocess-exited-with-error
 × Building wheel for pycatch22 (pyproject.toml) did not run successfully.
 │ exit code: 1
 ╰─> [253 lines of output]
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-cpython-310
    creating build/lib.linux-x86_64-cpython-310/pycatch22
    copying src/pycatch22/catch22.py -> build/lib.linux-x86_64-cpython-310/pycatch22
    copying src/pycatch22/__init__.py -> build/lib.linux-x86_64-cpython-310/pycatch22
    running egg_info
    writing src/pycatch22.egg-info/PKG-INFO
    writing dependency_links to src/pycatch22.egg-info/dependency_links.txt
    writing top-level names to src/pycatch22.egg-info/top_level.txt
    reading manifest file 'src/pycatch22.egg-info/SOURCES.txt'
    reading manifest template '[MANIFEST.in](http://manifest.in/)'
    adding license file 'LICENSE'
    writing manifest file 'src/pycatch22.egg-info/SOURCES.txt'
    copying src/pycatch22/.DS_Store -> build/lib.linux-x86_64-cpython-310/pycatch22
    running build_ext
    building 'catch22_C' extension
    creating build/temp.linux-x86_64-cpython-310
    creating build/temp.linux-x86_64-cpython-310/src
    creating build/temp.linux-x86_64-cpython-310/src/C
    gcc -pthread -B /data/spurneyma/miniconda/envs/winter2022/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /data/spurneyma/miniconda/envs/winter2022/include -fPIC -O2 -isystem /data/spurneyma/miniconda/envs/winter2022/include -fPIC -Isrc/C -I/data/spurneyma/miniconda/envs/winter2022/include/python3.10 -c src/C/CO_AutoCorr.c -o build/temp.linux-x86_64-cpython-310/src/C/CO_AutoCorr.o
    src/C/CO_AutoCorr.c: In function ‘dot_multiply’:
    src/C/CO_AutoCorr.c:61:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = 0; i < size; i++) {
       ^
    src/C/CO_AutoCorr.c:61:5: note: use option -std=c99 or -std=gnu99 to compile your code
    src/C/CO_AutoCorr.c: In function ‘CO_AutoCorr’:
    src/C/CO_AutoCorr.c:74:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = 0; i < size; i++) {
       ^
    src/C/CO_AutoCorr.c:84:14: error: redefinition of ‘i’
       for (int i = size; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:74:14: note: previous definition of ‘i’ was here
       for (int i = 0; i < size; i++) {
           ^
    src/C/CO_AutoCorr.c:84:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = size; i < nFFT; i++) {
       ^
    src/C/CO_AutoCorr.c:100:14: error: redefinition of ‘i’
       for (int i = 0; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:84:14: note: previous definition of ‘i’ was here
       for (int i = size; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:100:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = 0; i < nFFT; i++) {
       ^
    src/C/CO_AutoCorr.c:106:14: error: redefinition of ‘i’
       for (int i = 0; i < tau_size; i++) {
           ^
    src/C/CO_AutoCorr.c:100:14: note: previous definition of ‘i’ was here
       for (int i = 0; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:106:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = 0; i < tau_size; i++) {
       ^
    src/C/CO_AutoCorr.c: In function ‘co_autocorrs’:
    src/C/CO_AutoCorr.c:122:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = 0; i < size; i++) {
       ^
    src/C/CO_AutoCorr.c:131:14: error: redefinition of ‘i’
       for (int i = size; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:122:14: note: previous definition of ‘i’ was here
       for (int i = 0; i < size; i++) {
           ^
    src/C/CO_AutoCorr.c:131:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = size; i < nFFT; i++) {
       ^
    src/C/CO_AutoCorr.c:147:14: error: redefinition of ‘i’
       for (int i = 0; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:131:14: note: previous definition of ‘i’ was here
       for (int i = size; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:147:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = 0; i < nFFT; i++) {
       ^
    src/C/CO_AutoCorr.c:152:14: error: redefinition of ‘i’
       for (int i = 0; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:147:14: note: previous definition of ‘i’ was here
       for (int i = 0; i < nFFT; i++) {
           ^
    src/C/CO_AutoCorr.c:152:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for (int i = 0; i < nFFT; i++) {
       ^
    src/C/CO_AutoCorr.c: In function ‘CO_f1ecac’:
    src/C/CO_AutoCorr.c:183:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size; i++)
       ^
    src/C/CO_AutoCorr.c:198:13: error: redefinition of ‘i’
       for(int i = 0; i < size-2; i++){
           ^
    src/C/CO_AutoCorr.c:183:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < size; i++)
           ^
    src/C/CO_AutoCorr.c:198:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size-2; i++){
       ^
    src/C/CO_AutoCorr.c: In function ‘CO_Embed2_Basic_tau_incircle’:
    src/C/CO_AutoCorr.c:230:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size-tauIntern; i++)
       ^
    src/C/CO_AutoCorr.c: In function ‘CO_Embed2_Dist_tau_d_expfit_meandiff’:
    src/C/CO_AutoCorr.c:245:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size; i++)
       ^
    src/C/CO_AutoCorr.c:263:13: error: redefinition of ‘i’
       for(int i = 0; i < size-tau-1; i++)
           ^
    src/C/CO_AutoCorr.c:245:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < size; i++)
           ^
    src/C/CO_AutoCorr.c:263:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size-tau-1; i++)
       ^
    src/C/CO_AutoCorr.c:304:13: error: redefinition of ‘i’
       for(int i = 0; i < nBins; i++){
           ^
    src/C/CO_AutoCorr.c:263:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < size-tau-1; i++)
           ^
    src/C/CO_AutoCorr.c:304:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < nBins; i++){
       ^
    src/C/CO_AutoCorr.c:326:13: error: redefinition of ‘i’
       for(int i = 0; i < nBins; i++){
           ^
    src/C/CO_AutoCorr.c:304:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < nBins; i++){
           ^
    src/C/CO_AutoCorr.c:326:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < nBins; i++){
       ^
    src/C/CO_AutoCorr.c: In function ‘CO_FirstMin_ac’:
    src/C/CO_AutoCorr.c:355:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size; i++)
       ^
    src/C/CO_AutoCorr.c:366:13: error: redefinition of ‘i’
       for(int i = 1; i < size-1; i++)
           ^
    src/C/CO_AutoCorr.c:355:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < size; i++)
           ^
    src/C/CO_AutoCorr.c:366:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 1; i < size-1; i++)
       ^
    src/C/CO_AutoCorr.c: In function ‘CO_trev_1_num’:
    src/C/CO_AutoCorr.c:385:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size; i++)
       ^
    src/C/CO_AutoCorr.c:397:13: error: redefinition of ‘i’
       for(int i = 0; i < size-tau; i++)
           ^
    src/C/CO_AutoCorr.c:385:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < size; i++)
           ^
    src/C/CO_AutoCorr.c:397:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size-tau; i++)
       ^
    src/C/CO_AutoCorr.c: In function ‘CO_HistogramAMI_even_2_5’:
    src/C/CO_AutoCorr.c:418:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size; i++)
       ^
    src/C/CO_AutoCorr.c:432:13: error: redefinition of ‘i’
       for(int i = 0; i < size-tau; i++){
           ^
    src/C/CO_AutoCorr.c:418:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < size; i++)
           ^
    src/C/CO_AutoCorr.c:432:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size-tau; i++){
       ^
    src/C/CO_AutoCorr.c:444:13: error: redefinition of ‘i’
       for(int i = 0; i < numBins+1; i++){
           ^
    src/C/CO_AutoCorr.c:432:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < size-tau; i++){
           ^
    src/C/CO_AutoCorr.c:444:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < numBins+1; i++){
       ^
    src/C/CO_AutoCorr.c:469:13: error: redefinition of ‘i’
       for(int i = 0; i < size-tau; i++){
           ^
    src/C/CO_AutoCorr.c:444:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < numBins+1; i++){
           ^
    src/C/CO_AutoCorr.c:469:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < size-tau; i++){
       ^
    src/C/CO_AutoCorr.c:474:13: error: redefinition of ‘i’
       for(int i = 0; i < (numBins+1)*(numBins+1); i++){
           ^

src/C/CO_AutoCorr.c:469:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < size-tau; i++){
           ^
    src/C/CO_AutoCorr.c:474:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < (numBins+1)*(numBins+1); i++){
       ^
    src/C/CO_AutoCorr.c:493:13: error: redefinition of ‘i’
       for(int i = 0; i < numBins; i++){
           ^
    src/C/CO_AutoCorr.c:474:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < (numBins+1)*(numBins+1); i++){
           ^
    src/C/CO_AutoCorr.c:493:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < numBins; i++){
       ^
    src/C/CO_AutoCorr.c:494:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for(int j = 0; j < numBins; j++){
         ^
    src/C/CO_AutoCorr.c:504:13: error: redefinition of ‘i’
       for(int i = 0; i < numBins; i++){
           ^
    src/C/CO_AutoCorr.c:493:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < numBins; i++){
           ^
    src/C/CO_AutoCorr.c:504:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < numBins; i++){
       ^
    src/C/CO_AutoCorr.c:505:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for(int j = 0; j < numBins; j++){
         ^
    src/C/CO_AutoCorr.c:515:13: error: redefinition of ‘i’
       for(int i = 0; i < numBins; i++){
           ^
    src/C/CO_AutoCorr.c:504:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < numBins; i++){
           ^
    src/C/CO_AutoCorr.c:515:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < numBins; i++){
       ^
    src/C/CO_AutoCorr.c:516:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for(int j = 0; j < numBins; j++){
         ^
    src/C/CO_AutoCorr.c:532:13: error: redefinition of ‘i’
       for(int i = 0; i < numBins; i++){
           ^
    src/C/CO_AutoCorr.c:515:13: note: previous definition of ‘i’ was here
       for(int i = 0; i < numBins; i++){
           ^
    src/C/CO_AutoCorr.c:532:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
       for(int i = 0; i < numBins; i++){
       ^
    src/C/CO_AutoCorr.c:533:9: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for(int j = 0; j < numBins; j++){
         ^
    error: command '/usr/bin/gcc' failed with exit code 1
    [end of output]
 note: This error originates from a subprocess, and is likely not a problem with pip.
 ERROR: Failed building wheel for pycatch22
Failed to build pycatch22
ERROR: Could not build wheels for pycatch22, which is required to install pyproject.toml-based projects
benfulcher commented 1 year ago

Thanks! I'm not an expert on this, but hopefully someone who is sees this an can contribute a PR fix. (there is also the manual install last-resort mentioned at the bottom of the README)

moisesrsantos commented 1 year ago

Hello, I hope you are well. These errors occur because some systems do not use the C99 language by default (the C standard was published in 1999). This is necessary for counter-instructions to be done inside the "for" loop, for example.

To address this, in Pull request #9, the pattern "c99" was explicitly added to "CFLAGS" in "setup.py." This fixes the error; you can edit the solution or propose a different answer.

benfulcher commented 1 year ago

Thanks @moisesrsantos ! I'll check it out 😄