Python and ROOT when installing in WSL / Ubuntu


_ROOT Version: 6.20.04
_Platform: WSL with Ubuntu 18.04 or 19.10
Compiler: Not Provided


When I installed ROOT 6.20.04 under Windows Subsystem for Linux with Ubuntu 18.04, I had trouble with python, e.g., “import ROOT as rt” led to errors related to libpython2.7. Perhaps it is obvious, but I wanted to pass on the fix:

sudo apt install libpython2.7
sudo apt install python

The as-distributed Ubuntu has python3, but ROOT seems to have been built against 2.7. The two apt commands resolve this.

Things seem to work now, although I notice that one of the demos leads to a segv when the next demo is run (I think it was fillRandom) and sometimes ROOT hangs. I think the hang relates to clicking on certain help buttons and wonder if it relates to trying to open a browser (there’s no basis for that guess).

I’m new to ROOT, so if the WSL route is a bad idea that will be a dead end, please let me know. If I really need to dual-boot and run in Linux proper, I will, but would prefer not to.

It’s not only in Python. Even running fillrandom.C (from tutorials/hist) alone in root 6 (Ubuntu 18.04, WSL), it hangs, with messages like:

cling::DynamicLibraryManager::loadLibrary(): libgsl.so.23: cannot open shared object file: No such file or directory
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libMathMore.so for ROOT::Math::GSLIntegrator
cling::DynamicLibraryManager::loadLibrary(): libgsl.so.23: cannot open shared object file: No such file or directory
Warning in <ROOT::Math::IntegratorOneDim::CreateIntegrator>: Error loading one dimensional GSL integrator - use Gauss integrator

Here is a reduced example based on fillrandom:

void fillran1() {
   TCanvas *c1 = new TCanvas("c1","The FillRandom example",200,10,700,900);

   TFormula *form1 = new TFormula("form1","abs(sin(x)/x)");
   TF1 *sqroot = new TF1("sqroot","x*gaus(0) + [3]*form1",0,10);
   sqroot->SetParameters(10,4,1,20);
/*
   // works with these two instead:
   TF1 *sqroot = new TF1("sqroot","gaus(0)",0,10);
   sqroot->SetParameters(10,4,1);
*/
   sqroot->Draw();

   TH1F *h1f = new TH1F("h1f","Test random numbers",200,0,10);
   h1f->FillRandom("sqroot",1000);  // fails here
   h1f->Draw();
}

It looks like the problem is when sqroot includes “x”, but even adding a number (“gaus(0) + 3”), breaks it.

However, it works fine on root 5.34/38 on Windows.

Try: sudo apt-get install libgsl23

1 Like

Just to clarify my comment about the segv and fillrandom, it wasn’t related to python. It’s just while running .demo from ROOT. libgsl23 is already here and I just double checked that the segv still happens, just in case libgsl was installed later. You get to run fillrandom once. It runs fine. There is a message, “Warning in TCanvas::Constructor: Deleting canvas with same name: c1”, then fillrandom run stats. Things are fine at this point until you click the next demo, although sometimes you have to do a few demos before the segv. multifit just ran…and ran again…but then hsimple leads to a segv. Looks like we’re in cling::Interpreter:unload from MetaSema from MetaParser.

Back to the python: This must affect all Ubuntu 18 installations. Is there an installation / errata web page I missed? Or, maybe I missed some prerequisites?

Thanks.

ps. Wile E., This is Ed Frank from BaBar. :slight_smile: Ghost from the past…

After unpacking a ready-to-use binary distribution (i.e., compiled by somebody else), I first install all missing libraries reported by (ignore several possible “not a dynamic executable” messages):

source /where/I/unpacked/my/new/root/bin/thisroot.sh
ldd ${ROOTSYS}/lib/*.so | grep "found" | sort -u

On a Debian-like system (e.g., Ubuntu), one can then use “apt-file” to find, e.g., the missing “libgsl.so.23”:

sudo apt-get install apt-file; sudo apt-file update # needed just once
apt-file search libgsl.so.23 # returns the "libgsl23" package name

See also:

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