scikit-hep/root_numpy

environment bug with vim and pycharm

cxwx opened this issue · 5 comments

cxwx commented

When I use root_numpy with command "python p1.py", it works fine.
But if I use python in vim by use ":!python %" or using pycharm
it has some environment bug. like below

from . import _librootnumpy

File "/Users/chenxu/software/ROOT/install/lib/ROOT.py", line 318, in _importhook
return _orig_ihook( name, *args, **kwds )
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/root_numpy/_librootnumpy.so, 2): Library not loaded: @rpath/libHist.so
Referenced from: /usr/local/lib/python2.7/site-packages/root_numpy/_librootnumpy.so
Reason: image not found

I build ROOT by myself and install root_numpy from pip.

it seem to be some environment bug! Does some one has same problems?

@cxwx - for some reason, PyCharm is not picking up the shared library for root_numpy. Can you check to see what's located in /usr/local/lib/python2.7/site-packages/root_numpy/ and see if the shared library is there? This usually hints that pip installed root_numpy to a different place than what pycharm is looking at.

cxwx commented

$ls /usr/local/lib/python2.7/site-packages/root_numpy/

init.py _graph.py _matrix.pyc _utils.pyc info.pyc
init.pyc _graph.pyc _sample.py _warnings.py setup_utils.py
_array.py _hist.py _sample.pyc _warnings.pyc setup_utils.pyc
_array.pyc _hist.pyc _tree.py config.json testdata
_evaluate.py _librootnumpy.so _tree.pyc extern tests
_evaluate.pyc _matrix.py _utils.py info.py tmva


Then what happened if I used vim ":!python % "?

pycharm with root_numpy works fine for me. Though I have to set the ROOT environment first:

cd $ROOT_BASE_DIR (wherever you installed root)
source bin/thisroot.sh 

then I start pycharm from that shell. Let me know if you need more information about the environment...

cxwx commented

ROOT environment 'thisroot.sh' is always loaded
How do you install pycharm? From homebrew
I install pycharm by my self and start is by 'alias pycharm='/Applications/PyCharm\ CE.app/Contents/MacOS/pycharm'
with the same problem.

Should I install PyCharm profession version

I run pycharm on Ubuntu 14.02, I start pycharm with the following alias:

alias pycharm="$PYCHARM_INSTALLATION_DIR/bin/pycharm.sh &"

You could try to install root_numpy within pycharm, check this for instructions. I am using the professionals version, since its free for academic use.