Failed to install root_numpy with pip
lodurality opened this issue · 11 comments
I cannot install root_numpy through pip install --user root_numpy
.
It gives the following error:
_root_numpy/src/librootnumpy.cpp:251:19: fatal error: TFile.h: No such file or directory
#include "TFile.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
I've installed ROOT with sudo apt-get install root-system
(version 5.34/14). It seems to be working.
What does root-config --incdir
give you? And does that directory contain header files?
What does root-config --incdir
give you?
/usr/include/root
And does that directory contain header files?
Yes, but no Tfile.h. There are TFileCollection.h, TFileInfo.h and TFileMergeInfo.h though.
apt-file find TFile.h
libroot-io-dev: /usr/include/root/TFile.h
Can you install libroot-io-dev? root-system didn't install that?
(I normally install ROOT by building it from source myself)
I tried to build ROOT from source in /usr/local/root, but ./configure
doesn't work for me ('no such file or directory').
Yes I installed libroot-io-dev and several other libraries for other ROOT header files. Now pip install --user root_numpy
gives me the following:
_g++ -pthread -shared -L/home/deaddy/anaconda3/lib -Wl,-rpath=/home/deaddy/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.4/root_numpy/src/_librootnumpy.o -L/home/deaddy/anaconda3/lib -lpython3.4m -o build/lib.linux-x86_64-3.4/root_numpy/librootnumpy.cpython-34m.so -L/usr/lib/x86_64-linux-gnu -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -lTreePlayer
/usr/bin/ld: cannot find -lNet
/usr/bin/ld: cannot find -lPostscript
/usr/bin/ld: cannot find -lPhysics
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
Hmm... I need to add the minimal list of packages to install on ubuntu to our docs. Thanks for bringing this up. root_numpy also doesn't explicitly need to be linked to all that so I can prune down the list of libs to what is necessary. I suppose users normally install the "whole lot" so this isn't an issue. For now, try installing libroot-math-physics5.34, libroot-net5.34, and libroot-graf2d-postscript5.34
I did (libroot-net5.34 was already there), but attempt to install root_numpy gives the same output
_g++ -pthread -shared -L/home/deaddy/anaconda3/lib -Wl,-rpath=/home/deaddy/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.4/root_numpy/src/_librootnumpy.o -L/home/deaddy/anaconda3/lib -lpython3.4m -o build/lib.linux-x86_64-3.4/root_numpy/librootnumpy.cpython-34m.so -L/usr/lib/x86_64-linux-gnu -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -lTreePlayer
/usr/bin/ld: cannot find -lNet
/usr/bin/ld: cannot find -lPostscript
/usr/bin/ld: cannot find -lPhysics
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
I'll attempt this myself in a VM and will provide the full minimal list and possibly improve the build setup. Probably best now to try installing all libs if it isn't too much of a hassle.
I did sudo apt-get install libroot*
and it solved the problem. Thank you!
Strange. Installing root-system and libroot-bindings-python5.34 was sufficient on a fresh Ubuntu 15.10 VM.
Maybe it is my system's problems. I have Anaconada Python 3.4 in addition to system Python. And now I can't import ROOT in IPython, because it cant't find libPyROOT.co.
locate libPyROOT.so
gives
/usr/lib/python2.7/dist-packages/libPyROOT.so
/usr/lib/x86_64-linux-gnu/libPyROOT.so
/usr/lib/x86_64-linux-gnu/libPyROOT.so.5.34
/usr/lib/x86_64-linux-gnu/root5.34/libPyROOT.so
/usr/lib/x86_64-linux-gnu/root5.34/libPyROOT.so.5
/usr/lib/x86_64-linux-gnu/root5.34/libPyROOT.so.5.34
/usr/local/root/lib/libPyROOT.so
I can't figure, how to correctly set environment variables. Now they set to:
PYTHONPATH=/usr/share/python-support/root/
ROOTSYS=/usr/lib/x86_64-linux-gnu/root5.34/
I'm not sure that I should address this question to you, because it more of the ROOT configuration, not root_numpy.
Also check your LD_LIBRARY_PATH. Make sure the version of the library picked up was built against the same version of python that is currently running.