Problem installing root_numpy

Hi guys,

I have trouble installing root_numpy and root_pandas, I want to use an analysis about LHCb open data and I need this two packages to work with it.

the error message when I run the command pip install --user root_numpy is

Collecting root_numpy
  Using cached root_numpy-4.8.0.tar.gz (520 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: root_numpy
  Building wheel for root_numpy (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [347 lines of output]

and

      In file included from /home/commodo98/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,
                       from /home/commodo98/.local/lib/python3.10/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                       from /home/commodo98/.local/lib/python3.10/site-packages/numpy/core/include/numpy/arrayobject.h:5,
                       from root_numpy/tmva/src/_libtmvanumpy.cpp:581:
      /home/commodo98/.local/lib/python3.10/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
         17 | #warning "Using deprecated NumPy API, disable it with " \
            |  ^~~~~~~
      root_numpy/tmva/src/evaluate.pyx: In function ‘PyObject* __pyx_f_13_libtmvanumpy_evaluate_twoclass(TMVA::MethodBase*, PyArrayObject*, double)’:
      root_numpy/tmva/src/evaluate.pyx:59:20: error: ‘const TMVA::Event* TMVA::MethodBase::fTmpEvent’ is protected within this context
         59 |     _method.fTmpEvent = event
            |                    ^~~~~~~~~
      In file included from root_numpy/tmva/src/_libtmvanumpy.cpp:598:
      /home/commodo98/root/builddir/include/TMVA/MethodBase.h:445:28: note: declared protected here
        445 |       mutable const Event *fTmpEvent; //! temporary event when testing on a different DataSet than the own one
            |                            ^~~~~~~~~
      root_numpy/tmva/src/evaluate.pyx:69:20: error: ‘const TMVA::Event* TMVA::MethodBase::fTmpEvent’ is protected within this context
         69 |     _method.fTmpEvent = NULL
            |                    ^~~~~~~~~
      In file included from root_numpy/tmva/src/_libtmvanumpy.cpp:598:
      /home/commodo98/root/builddir/include/TMVA/MethodBase.h:445:28: note: declared protected here
        445 |       mutable const Event *fTmpEvent; //! temporary event when testing on a different DataSet than the own one
            |                            ^~~~~~~~~
      root_numpy/tmva/src/evaluate.pyx: In function ‘PyObject* __pyx_f_13_libtmvanumpy_evaluate_multiclass(TMVA::MethodBase*, PyArrayObject*, unsigned int)’:
      root_numpy/tmva/src/evaluate.pyx:82:20: error: ‘const TMVA::Event* TMVA::MethodBase::fTmpEvent’ is protected within this context
         82 |     _method.fTmpEvent = event
            |                    ^~~~~~~~~
      In file included from root_numpy/tmva/src/_libtmvanumpy.cpp:598:
      /home/commodo98/root/builddir/include/TMVA/MethodBase.h:445:28: note: declared protected here
        445 |       mutable const Event *fTmpEvent; //! temporary event when testing on a different DataSet than the own one
            |                            ^~~~~~~~~
      root_numpy/tmva/src/evaluate.pyx:88:20: error: ‘const TMVA::Event* TMVA::MethodBase::fTmpEvent’ is protected within this context
         88 |     _method.fTmpEvent = NULL
            |                    ^~~~~~~~~
      In file included from root_numpy/tmva/src/_libtmvanumpy.cpp:598:
      /home/commodo98/root/builddir/include/TMVA/MethodBase.h:445:28: note: declared protected here
        445 |       mutable const Event *fTmpEvent; //! temporary event when testing on a different DataSet than the own one
            |                            ^~~~~~~~~
      root_numpy/tmva/src/evaluate.pyx: In function ‘PyObject* __pyx_f_13_libtmvanumpy_evaluate_regression(TMVA::MethodBase*, PyArrayObject*, unsigned int)’:
      root_numpy/tmva/src/evaluate.pyx:101:20: error: ‘const TMVA::Event* TMVA::MethodBase::fTmpEvent’ is protected within this context
        101 |     _method.fTmpEvent = event
            |                    ^~~~~~~~~
      In file included from root_numpy/tmva/src/_libtmvanumpy.cpp:598:
      /home/commodo98/root/builddir/include/TMVA/MethodBase.h:445:28: note: declared protected here
        445 |       mutable const Event *fTmpEvent; //! temporary event when testing on a different DataSet than the own one
            |                            ^~~~~~~~~
      root_numpy/tmva/src/evaluate.pyx:107:20: error: ‘const TMVA::Event* TMVA::MethodBase::fTmpEvent’ is protected within this context
        107 |     _method.fTmpEvent = NULL
            |                    ^~~~~~~~~
      In file included from root_numpy/tmva/src/_libtmvanumpy.cpp:598:
      /home/commodo98/root/builddir/include/TMVA/MethodBase.h:445:28: note: declared protected here
        445 |       mutable const Event *fTmpEvent; //! temporary event when testing on a different DataSet than the own one
            |                            ^~~~~~~~~
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from root_numpy/tmva/src/_libtmvanumpy.cpp:4:
      cython_utility: In function ‘int __Pyx_ParseOptionalKeywords(PyObject*, PyObject***, PyObject*, PyObject**, Py_ssize_t, const char*)’:
      /usr/include/python3.10/cpython/unicodeobject.h:451:61: warning: ‘Py_ssize_t _PyUnicode_get_wstr_length(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        451 | #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:261:7: note: in expansion of macro ‘PyUnicode_WSTR_LENGTH’
        261 |       PyUnicode_WSTR_LENGTH(op) :                    \
            |       ^~~~~~~~~~~~~~~~~~~~~
      cython_utility:137:22: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:262:33: warning: ‘Py_UNICODE* PyUnicode_AsUnicode(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        262 |       ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
            |              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      cython_utility:137:22: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:451:61: warning: ‘Py_ssize_t _PyUnicode_get_wstr_length(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        451 | #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:264:8: note: in expansion of macro ‘PyUnicode_WSTR_LENGTH’
        264 |        PyUnicode_WSTR_LENGTH(op)))
            |        ^~~~~~~~~~~~~~~~~~~~~
      cython_utility:137:22: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:451:61: warning: ‘Py_ssize_t _PyUnicode_get_wstr_length(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        451 | #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:261:7: note: in expansion of macro ‘PyUnicode_WSTR_LENGTH’
        261 |       PyUnicode_WSTR_LENGTH(op) :                    \
            |       ^~~~~~~~~~~~~~~~~~~~~
      cython_utility:137:52: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:262:33: warning: ‘Py_UNICODE* PyUnicode_AsUnicode(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        262 |       ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
            |              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      cython_utility:137:52: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:451:61: warning: ‘Py_ssize_t _PyUnicode_get_wstr_length(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        451 | #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:264:8: note: in expansion of macro ‘PyUnicode_WSTR_LENGTH’
        264 |        PyUnicode_WSTR_LENGTH(op)))
            |        ^~~~~~~~~~~~~~~~~~~~~
      cython_utility:137:52: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:451:61: warning: ‘Py_ssize_t _PyUnicode_get_wstr_length(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        451 | #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:261:7: note: in expansion of macro ‘PyUnicode_WSTR_LENGTH’
        261 |       PyUnicode_WSTR_LENGTH(op) :                    \
            |       ^~~~~~~~~~~~~~~~~~~~~
      cython_utility:153:26: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:262:33: warning: ‘Py_UNICODE* PyUnicode_AsUnicode(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        262 |       ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
            |              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      cython_utility:153:26: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:451:61: warning: ‘Py_ssize_t _PyUnicode_get_wstr_length(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        451 | #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:264:8: note: in expansion of macro ‘PyUnicode_WSTR_LENGTH’
        264 |        PyUnicode_WSTR_LENGTH(op)))
            |        ^~~~~~~~~~~~~~~~~~~~~
      cython_utility:153:26: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:451:61: warning: ‘Py_ssize_t _PyUnicode_get_wstr_length(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        451 | #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:261:7: note: in expansion of macro ‘PyUnicode_WSTR_LENGTH’
        261 |       PyUnicode_WSTR_LENGTH(op) :                    \
            |       ^~~~~~~~~~~~~~~~~~~~~
      cython_utility:153:59: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:262:33: warning: ‘Py_UNICODE* PyUnicode_AsUnicode(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        262 |       ((void)PyUnicode_AsUnicode(_PyObject_CAST(op)),\
            |              ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
      cython_utility:153:59: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:451:61: warning: ‘Py_ssize_t _PyUnicode_get_wstr_length(PyObject*)’ is deprecated [-Wdeprecated-declarations]
        451 | #define PyUnicode_WSTR_LENGTH(op) _PyUnicode_get_wstr_length((PyObject*)op)
            |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
      /usr/include/python3.10/cpython/unicodeobject.h:264:8: note: in expansion of macro ‘PyUnicode_WSTR_LENGTH’
        264 |        PyUnicode_WSTR_LENGTH(op)))
            |        ^~~~~~~~~~~~~~~~~~~~~
      cython_utility:153:59: note: in expansion of macro ‘PyUnicode_GET_SIZE’
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      error: command '/usr/bin/x86_64-linux-gnu-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: legacy-install-failure

× Encountered error while trying to install package.
╰─> root_numpy

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

A lot of message between the outputs I have reported here.

Thank you in advance


posting code_

ROOT Version: ROOT 6.26/10
Platform: Ubuntu 22.04.1 LTS
Compiler: Not Provided


Hi @Adrianodelvincio!

Sorry, we can’t help here. The root_numpy and root_pandas packages are not part of ROOT, and they are both deprecated and unmaintained:

Please don’t use them, it’s probably very difficult to get them to compile now.

If you want to get NumPy arrays out of ROOT files, you should better use directly. You can open the files with RDataFrame and then use AsNumpy() to get your arrays. Alternatively, you can also do your analysis completely in RDataFrame to begin with, or if you don’t want to use ROOT you can install the uproot python package that succeeded root_numpy.

Thank you for your answer.

Yeah, I know I can use different solution with root dataframe, the problem is that this analysis is 7 years old, so I need to write in a different way the code they used. The code is not updated, so there is no solution at this point.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.