Importing libraries with pyROOT

I’m having trouble importing my libraries from specific directories into pyROOT with MacOS 10.12.

I am using the commit here as per guidance here.

My library lives in

~/analysis/Analysis/PredictedDistribution/standalone

and my environment variables are:

SHLIB_PATH=/Users/rappoccio/analysis/Analysis/PredictedDistribution/standalone:/software/root-v6-11-02-install/lib
LIBPATH=/Users/rappoccio/analysis/Analysis/PredictedDistribution/standalone:/software/root-v6-11-02-install/lib
PYTHONPATH=/Users/rappoccio/analysis/Analysis/PredictedDistribution/standalone:/software/root-v6-11-02-install/lib
DYLD_LIBRARY_PATH=/Users/rappoccio/analysis/Analysis/PredictedDistribution/standalone:/software/root-v6-11-02-install/lib
LD_LIBRARY_PATH=/Users/rappoccio/analysis/Analysis/PredictedDistribution/standalone:/software/root-v6-11-02-install/lib
PREDDIST_DIR=/Users/rappoccio/analysis/Analysis/PredictedDistribution

So I use ROOT:

root [0] gSystem->Load("libAnalysisPredictedDistribution.so");
root [1] b = BinomialEff();
root [2] b.Nt = 100
(double) 100.000000

That is happy.

Then I try pyroot:

>>> import ROOT
>>> ROOT.gSystem.Load("libAnalysisPredictedDistribution.so")

and it is unhappy:

Error in <TMacOSXSystem::FindDynamicLibrary>: libAnalysisPredictedDistribution.so does not exist in .:/software/root-v6-11-02-install/lib:/usr/local/lib:/usr/X11R6/lib:/usr/lib:/lib:/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/lib64:/lib64:

but, if I explicitly tell it where to go, it is happy again:

>>> import ROOT
>>> ROOT.gSystem.Load("libAnalysisPredictedDistribution.so")
>>> import os
>>> ROOT.gSystem.Load( '%s/standalone/libAnalysisPredictedDistribution.so' % ( os.getenv('PREDDIST_DIR') ) )
0
>>> b = ROOT.BinomialEff()
>>> b.Nt = 100.
>>> b.Nt
100.0

What am I doing wrong, or is this another bug?

Are you using the system-provided python? If yes, install one from any of the packagers (MacPorts, Homebrew, etc.) or directly from source and use that. Apple uses Python in all kinds of system utilities and has modified it (as a security measure) not to use dynamic linker envars.

Thanks for the response. Yes, I’m using the system python, on recommendations from other ROOT posts ;). OK, I will try another python version.

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