scikit-hep / root_numpy

The interface between ROOT and NumPy

Home Page:http://scikit-hep.org/root_numpy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't build _librootnumpy

tdoughty1 opened this issue · comments

I work on the CDMS experiment and we are looking at using the root_numpy module for the basis of a Python development framework we are developing and it is great! Thanks for sharing it.

One problem we are running into is our file format includes directories above the tree level. I have been working on creating a list_directories function that I was hoping to use as a pull request. However, when I attempted to recompile to test the output, the compiling fails. I reset the repo to match the current master and tried running make and it failed again.

I am using gcc 4.9.3 on Ubuntu 14.04 and numpy version 1.10.1. What is the master _librootnumpy.cpp file compiled with?

Thanks.

For detailed info, I get the following error message:
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ In file included from /home/tdoughty1/Packages/anaconda/envs/PyCAP/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1781:0, from /home/tdoughty1/Packages/anaconda/envs/PyCAP/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:18, from /home/tdoughty1/Packages/anaconda/envs/PyCAP/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4, from root_numpy/src/_librootnumpy.cpp:257: /home/tdoughty1/Packages/anaconda/envs/PyCAP/lib/python2.7/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 " \ ^ root_numpy/src/converters.pyx: In function ‘int __pyx_f_13_librootnumpy_create_numpyarray_vectorbool(void*, std::vector<bool>*)’: root_numpy/src/converters.pyx:85:17: error: no match for ‘operator=’ (operand types are ‘__Pyx_FakeReference<bool>’ and ‘std::vector<bool>::reference {aka std::_Bit_reference}’) tmp[i] = src.at(i) ^ root_numpy/src/converters.pyx:85:17: note: candidate is: root_numpy/src/_librootnumpy.cpp:220:7: note: __Pyx_FakeReference<bool>& __Pyx_FakeReference<bool>::operator=(const __Pyx_FakeReference<bool>&) class __Pyx_FakeReference { ^ root_numpy/src/_librootnumpy.cpp:220:7: note: no known conversion for argument 1 from ‘std::vector<bool>::reference {aka std::_Bit_reference}’ to ‘const __Pyx_FakeReference<bool>&’ error: command 'gcc' failed with exit status 1 make: *** [inplace] Error 1

Yes, this is a Cython bug, I believe (not an issue with gcc version). Cython is generating invalid code for vector<bool>. I don't think it has been fixed in Cython yet and I still need to follow this up with them.

I use Cython 0.21.2 since this bug is not present. Install it with: pip install -U Cython==0.21.2

Great, that did it. Thanks for your help!