Re: configuration issues

248 views
Skip to first unread message

Kyle Cranmer

unread,
Feb 28, 2014, 11:00:41 PM2/28/14
to rootp...@googlegroups.com, Kyle Stuart Cranmer
Hello

I recently got rootpy working, but had issues with root_numpy. I just got a new laptop (OS X) and I’ve been installing everything fresh. I’m not able to run any of the plotting examples, but I’m not quite sure what the problem is.

For example:
rootpy$ python examples/plotting/plot_matplotlib_graph.py 
...
Traceback (most recent call last):
  File "examples/plotting/plot_matplotlib_graph.py", line 18, in <module>
    import rootpy.plotting.root2matplotlib as rplt
  File "/Library/Python/2.7/site-packages/rootpy/plotting/root2matplotlib.py", line 5, in <module>
    ROOT.kTRUE
  File "/Users/cranmer/projects/roostats/root-v5-34/lib/ROOT.py", line 438, in __getattr1
    self.__finalSetup()
  File "/Library/Python/2.7/site-packages/rootpy/defaults.py", line 129, in wrapFinalSetup
    configure_defaults()
  File "/Library/Python/2.7/site-packages/rootpy/defaults.py", line 87, in configure_defaults
    init()
  File "/Library/Python/2.7/site-packages/rootpy/interactive/rootwait.py", line 34, in fetch_vars
    _processRootEvents = getattr(ROOT.PyGUIThread, "_Thread__target", None)
  File "/Users/cranmer/projects/roostats/root-v5-34/lib/ROOT.py", line 469, in __getattr2
    attr = _root.LookupRootEntity( name )
AttributeError: PyGUIThread

when I try to run the import lines of that example directly, I see:

>>> import rootpy.plotting.root2matplotlib as rplt
WARNING:rootpy.interactive.rootwait] unable to access ROOT's GUI thread either because PyROOT's finalSetup() was called while in batch mode or because PyROOT is using the new PyOS_InputHook based mechanism that is not yet supported in rootpy (PyConfig.StartGuiThread == 'inputhook' or gSystem.InheritsFrom('TMacOSXSystem')). wait() etc. will instead call raw_input() and wait for [Enter]

A similar problem:

rootpy$ python
Python 2.7.5 (default, Sep 12 2013, 21:33:34) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rootpy
>>> rootpy.log.basic_config_colorized()
>>> from rootpy.plotting import F1, Hist, HistStack, Graph, Canvas, set_style
rootpy/compiled.py:8: UserWarning: Module rootpy was already imported from rootpy/__init__.pyc, but /Library/Python/2.7/site-packages is being added to sys.path
  import pkg_resources


Details on my configuration

Currenlty I have 
rootpy$ python --version
Python 2.7.5
rootpy$ pip -V
pip 1.5.4 from /Library/Python/2.7/site-packages (python 2.7)
rootpy$ which root
/Users/cranmer/projects/roostats/root-v5-34/bin/root

rootpy$ python
Python 2.7.5 (default, Sep 12 2013, 21:33:34) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
>>> import rootpy
>>> import root_numpy
>>> root_numpy.__version__
'3.2.0'
>>> import matplotlib
>>> matplotlib.__version__
‘1.3.1'

Installation issue: When I tried 
rootpy$ sudo python setup.py install
ROOT cannot be imported. Is ROOT installed with PyROOT enabled?

I’m not sure what the issue is there since I definitely have pyroot enabled.
So instead I did 

sudo pip install rootpy
which installed
rootpy-0.7.1.tar.gz
which seems to be the same as what I have from git.

Thanks

Kyle

Noel Dawe

unread,
Feb 28, 2014, 11:26:26 PM2/28/14
to rootp...@googlegroups.com, Kyle Stuart Cranmer
Hi Kyle,

I'll try to answer as best as I can. I use GNU/Linux but I know many others that have rootpy and root_numpy working in OSX. We have had issues with root_numpy not compiling on OSX with clang but I believe that has been fixed. Let me know if you see many compiler warnings with clang and I can try to fix those. root_numpy compilation is fairly clean for me.

From the lines:

Module rootpy was already imported from rootpy/__init__.pyc, but /Library/Python/2.7/site-packages is being added to sys.path

and:


File "/Library/Python/2.7/site-packages/rootpy/interactive/rootwait.py", line 34, in fetch_vars

I think you might have an older version of rootpy installed globally (0.7.1) under /Library and the git master in your current directory.

I would suggest installing rootpy at the user level with "./setup.py install --user" and to not use the version on PyPI with pip since the latest master on github contains fixes related to that AttributeError: PyGUIThread. I intend to release version 0.8.0 very soon but 0.7.1 was released last March and rootpy has evolved quite a bit since then.

Because you are using an installation of ROOT under your home directory and probably have the environment setup only for your account, you will need to pass the environment variables to sudo so ROOT is still importable there:

rootpy$ which root
/Users/cranmer/projects/roostats/root-v5-34/bin/root

rootpy$ sudo python setup.py install
ROOT cannot be imported. Is ROOT installed with PyROOT enabled?

As on my system:

20:18|silas:0/11 rootpy (master $ u=)> sudo python -c "import ROOT"
[sudo] password for endw
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named ROOT
20:18|silas:0/11 rootpy (master $ u=)> python -c "import ROOT"
20:20|silas:0/11 rootpy (master $ u=)> 
20:21|silas:0/11 rootpy (master $ u=)> sudo ROOTSYS=$ROOTSYS PYTHONPATH=$PYTHONPATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH python -c "import ROOT"
20:21|silas:0/11 rootpy (master $ u=)> 


Can you try uninstalling rootpy under /Library and installing only the latest master with --user? Otherwise if you update the globally installed version to the latest master, the examples should work.

I tend to prefer installing with --user if packages will only be used by me. I find this is easier to manage and to avoid accidentally having multiple versions conflicting.

Cheers,
Noel

--
You received this message because you are subscribed to the Google Groups "rootpy dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rootpy-dev+...@googlegroups.com.
To post to this group, send email to rootp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rootpy-dev/5AF4EDB7-D7FF-4EF6-A1E3-EC0D5E25306A%40cern.ch.
For more options, visit https://groups.google.com/groups/opt_out.

Noel Dawe

unread,
Feb 28, 2014, 11:39:51 PM2/28/14
to rootp...@googlegroups.com, Kyle Stuart Cranmer
You can verify that you are using the intended installation of rootpy with:

python -c "import rootpy; print rootpy.__file__"
/home/endw/.local/lib/python2.7/site-packages/rootpy-dev-py2.7.egg/rootpy/__init__.pyc

The --user option at installation puts packages under ~/.local
Reply all
Reply to author
Forward
0 new messages