Home | News | Documentation | Download

Setting up a Jupyter ROOTbook with TMVA on Mac

jupyter

#1

Hello,
I am desperately trying to get my computer set up so that I can open up a Jupyter notebook, read in a .root file, and start creating a neural network classifier with TMVA (or maybe TensorFlow). It seems like I need to install ROOT in order to make this happen, but I’m having trouble doing that successfully.

I’m running macOS 10.13.3, gcc version 4.2.1.

I already have Anaconda 3 installed and have used Jupyter notebooks just fine before, but never with ROOT. I tried following these instructions for installing ROOT via Anaconda, but have run into some issues post-installation.

Here’s what I’ve been able to do successfully:

$ conda create --name=atlasproject root=6 python=3

Then, I try to do some setup:

$ source ~/anaconda3/pkgs/root-6.04-py3.4_clang503/bin/thisroot.sh
$ source activate atlasproject
-bash: /bin/thisroot.sh: No such file or directory
Activate: ROOT has been sourced. Environment settings are ready.
ROOTSYS=/Users/morgangillis/anaconda3/pkgs/root-6.04-py3.4_clang503

After this, I try to test ROOT, and I get the splash screen along with this error message:

$ root -b -q
dyld: Symbol not found: __cg_png_create_info_struct
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /Users/morgangillis/anaconda3/envs/atlasproject/lib/libPng.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO

Trying to import ROOT in Python leads to a mess:

$ python
Python 3.4.5 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:47:57) 
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ROOT
ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!
Invoking:
    echo | LC_ALL=C /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64  -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fno-common -Qunused-arguments -pthread -std=c++11 -Wno-deprecated-declarations -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -stdlib=libc++ -Wno-comment -Wno-unused-parameter -Wno-conditional-uninitialized -Wno-parentheses-equality -Wno-unused-private-field  -fPIC -fvisibility-inlines-hidden -std=c++11 -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -O2 -DNDEBUG -xc++ -E -v - 2>&1 >/dev/null | awk '/^#include </,/^End of search/{if (!/^#include </ && !/^End of search/){ print }}' | grep -E "(c|g)\+\+"
results in
with exit code 256
input_line_1:1:10: fatal error: 'new' file not found
#include <new>
         ^
input_line_3:38:10: fatal error: 'string' file not found
#include <string>
         ^
Error in <TClass::LoadClassInfo>: no interpreter information for class __wrap_iter<char*> is available eventhough it has a TClass initialization routine.

#2

Hi @mgillis,

Using Anaconda and ROOT together requires that ROOT is built using the Anaconda compiler. Otherwise problems can arise when running PyROOT.

What I would recommend is to use a vanilla Python installation (non Anaconda), and to build ROOT while making sure it uses that Python installation, following the instructions here:

https://root.cern.ch/building-root

Once you have built and installed ROOT and configured your environment to use it, you should be able to run TMVA from a Python Jupyter notebook. Alternatively, you can run root --notebook and it will start Jupyter with an additional ROOT C++ kernel, in case you want to program in C++.

Cheers,

Enric


#3

Hi Enric,

Thanks for the suggestion! Building ROOT took quite a while but it worked in the end!


#4

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