scikit-learn-contrib / py-earth

A Python implementation of Jerome Friedman's Multivariate Adaptive Regression Splines
http://contrib.scikit-learn.org/py-earth/
BSD 3-Clause "New" or "Revised" License
458 stars 121 forks source link

"Using deprecated NumPy API" error #192

Closed cscherrer closed 5 years ago

cscherrer commented 5 years ago

Thanks for your work on this, looks like great stuff. I'm hitting an installation error:

gcc -pthread -B /home/chad/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/chad/miniconda3/lib/python3.6/site-packages/numpy/core/include -I/home/chad/miniconda3/include/python3.6m -c pyearth/_util.c -o build/temp.linux-x86_64-3.6/pyearth/_util.o
In file included from /home/chad/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1823,
                 from /home/chad/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                 from /home/chad/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from pyearth/_util.c:495:
/home/chad/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it by " \
  ^~~~~~~
gcc -pthread -shared -B /home/chad/miniconda3/compiler_compat -L/home/chad/miniconda3/lib -Wl,-rpath=/home/chad/miniconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/pyearth/_util.o -o /home/chad/git/py-earth/pyearth/_util.cpython-36m-x86_64-linux-gnu.so
/home/chad/miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/pyearth/_util.o: unable to initialize decompress status for section .debug_info
/home/chad/miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/pyearth/_util.o: unable to initialize decompress status for section .debug_info
/home/chad/miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/pyearth/_util.o: unable to initialize decompress status for section .debug_info
/home/chad/miniconda3/compiler_compat/ld: build/temp.linux-x86_64-3.6/pyearth/_util.o: unable to initialize decompress status for section .debug_info
build/temp.linux-x86_64-3.6/pyearth/_util.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

I haven't used Cython, so I'm not sure how to go about digging into this. Any suggestions?

jcrudy commented 5 years ago

@cscherrer The deprecated numpy API message is just a warning and can be ignored. Unfortunately I'm not sure what's actually going wrong. Somehow, _util.o, which you've just compiled with your gcc, is not compatible with your gcc? There may be some problem with your development environment. I would suggest trying to build another Cython package to see if you get the same error. You could make your own simple example, or maybe try this one:

https://github.com/modusdatascience/choldate

If you find that you can compile a simple cython package but not py-earth, I would suggest:

  1. Rebuild your conda environment, delete any build directory, .o, or .so files from py-earth's source directory, and try again.

  2. If that doesn't work, post here again with details about your conda, numpy, python, and cython versions, as well as operating system and what installation process you are using.

If you're not already, installing via conda or pip may be easier.

cscherrer commented 5 years ago

Thanks, I found that because I'm using miniconda, I had a conda installation of cython, but only a system gcc. I fixed this, but I'm still getting the error.

I don't see this in conda-forge, how can I conda install it?

jcrudy commented 5 years ago

It's name on conda-forge is sklearn-contrib-py-earth, which probably should be advertised somewhere. So, to install you can do:

conda install -c conda-forge sklearn-contrib-py-earth
cscherrer commented 5 years ago

Oh weird, that seemed to have worked but couldn't run any examples, and the installation somehow broke my jupyter. Probably should be testing these things in a conda environment

jcrudy commented 5 years ago

@cscherrer I can only share your bafflement. I you find any clues and want to share them, I could perhaps help more. In these kinds of situations I usually just start a new environment from scratch.

cscherrer commented 5 years ago

Yeah I'm going to do some general system updates and try in a new environment. Internet is spotty right now so it's taking much longer than usual. I'll let you know if there's a definitive solution or evidence the error is specific to py-earth. I'll close this issue for now at least, thank you for your time!