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

Problem with import root_numpy

vlisovsk opened this issue · comments

Hello, I have the ROOT 5.34/34 installed some time ago from Homebrew. Now I need to install the root_numpy. I do it via
pip install root_numpy
Then I try to import root_numpy in python and get this error:

import root_numpy
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/Cellar/root/5.34.34_1/lib/root/ROOT.py", line 352, in _importhook
return _orig_ihook( name, *args, **kwds )
File "/usr/local/lib/python2.7/site-packages/root_numpy/init.py", line 51, in
from ._tree import (
File "/usr/local/Cellar/root/5.34.34_1/lib/root/ROOT.py", line 352, in _importhook
return _orig_ihook( name, *args, **kwds )
File "/usr/local/lib/python2.7/site-packages/root_numpy/_tree.py", line 6, in
from . import _librootnumpy
File "/usr/local/Cellar/root/5.34.34_1/lib/root/ROOT.py", line 352, in _importhook
return _orig_ihook( name, *args, **kwds )
File "root_numpy/src/setup.pxi", line 5, in init _librootnumpy (root_numpy/src/_librootnumpy.cpp:5)
File "init.pxd", line 989, in numpy.import_array (root_numpy/src/_librootnumpy.cpp:989)
ImportError: numpy.core.multiarray failed to import

At the same time, import ROOT works fine.
I checked that numpy is latest version 1.12.1 and even reinstalled it again, import numpy works fine.
Python has version 2.7.11.
Does anyone has an idea how to solve this issue?

Please update your numpy installation:

pip install --upgrade numpy

Your numpy version is too old and does not contain the numpy.core.multiarray library.

@ndawe - we should probably add a min-version requirement?

When I do pip install --upgrade numpy, it says

Requirement already up-to-date: numpy in /usr/local/lib/python2.7/site-packages

I also tried pip install numpy --upgrade --ignore-installed but importing root_numpy still does not work.

Upd:
Also, if i type in python import numpy.core.multiarray, this gives no error. But importing root_numpy still does not work.

Try:

pip uninstall numpy root_numpy

and then

pip install --upgrade --ignore-installed --no-cache-dir numpy root_numpy

Thanks a lot, it seems this solved the issue!

Thanks @kratsg! Fast response as usual...