Jupyter is Crashing while running import ROOT

While running the pyROOT code in visual Studio code, the 1st step is to import the ROOT libraries. But while doing so, my Jupyter notebook is crashing with the following Output(same thing is happening even if my code consist of only “import ROOT”):

The Kernel crashed while executing code in the the current cell or a previous cell. Please review the code in the cell(s) to identify a possible cause of the failure. Click here for more info. View Jupyter log for further details.

But, when i run a normal .py file with my codes for histogram, it works fine even though it takes almost a minute to import the ROOT libraries.

Are there any solutions for this?

The Log File content is shown below:

#define _BACKWARD_BACKWARD_WARNING_H
// Inline headers
#include "TGDMLMatrix.h"
#include "TGeoArb8.h"
#include "TGeoAtt.h"
#include "TGeoBBox.h"
#include "TGeoBoolNode.h"
#include "TGeoBranchArray.h"
#include "TGeoBuilder.h"
#include "TGeoCache.h"
#include "TGeoCompositeShape.h"
#include "TGeoCone.h"
#include "TGeoElement.h"
#include "TGeoEltu.h"
#include "TGeoExtension.h"
#include "TGeoGlobalMagField.h"
#include "TGeoHalfSpace.h"
#include "TGeoHelix.h"
#include "TGeoHype.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMatrix.h"
#include "TGeoMedium.h"
#include "TGeoNavigator.h"
#include "TGeoNode.h"
#include "TGeoOpticalSurface.h"
#include "TGeoPara.h"
#include "TGeoParaboloid.h"
#include "TGeoParallelWorld.h"
#include "TGeoPatternFinder.h"
#include "TGeoPcon.h"
#include "TGeoPgon.h"
#include "TGeoPhysicalConstants.h"
#include "TGeoPhysicalNode.h"
#include "TGeoPolygon.h"
#include "TGeoRCPtr.h"
#include "TGeoRegion.h"
#include "TGeoScaledShape.h"
#include "TGeoShape.h"
#include "TGeoShapeAssembly.h"
#include "TGeoSphere.h"
#include "TGeoStateInfo.h"
#include "TGeoSystemOfUnits.h"
#include "TGeoTorus.h"
#include "TGeoTrd1.h"
#include "TGeoTrd2.h"
#include "TGeoTube.h"
#include "TGeoUniformMagField.h"
#include "TGeoVolume.h"
#include "TGeoVoxelFinder.h"
#include "TGeoXtru.h"
#include "TGeoTessellated.h"
#include "TGeoVector3.h"
#include "TVirtualGeoConverter.h"
#include "TVirtualGeoPainter.h"
#include "TVirtualGeoTrack.h"
#include "TVirtualMagField.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

A21:33:55.863 [info] Dispose Kernel process 12500.
21:33:55.912 [info] End cell 5 execution @ undefined, started @ 1697731288457, elapsed time = -1697731288.457s

ROOT Version: 6.28
Platform: Windows
Compiler: Python 3.8.8

Hi @Anantha_Padmanabhan,
thanks for reaching out!
I believe that your problem could be related to a mismatch in your environments, are you sure that the python interpreter you invoke at command line is the same in your notebook?

Cheers,
Monica

Yes,
Both of them are Python 3.8.8

Also, there are other installations of python like 3.9,3.10 etc. but all of them is below the python 3.8.8 in PATH.

I believe the python version shown on the top right is the one (3.8.8), also the same is shown in the command prompt when i run python.

The command which python from your command line and the command ! which python from your Jupyter notebook give the same result, is it correct? Or they are different paths to python 3.8.8 interpreters?

Also, how did you install ROOT? What platform do you use?

Monica

I am using a precompiled version (which I downloaded from the ROOT.cern website)(6.28.00) of ROOT in windows 10 Home edition. When i open python from powershell, this is what iam getting:
image

and from the jupyter notebook I am selecting this python: (There is only one installation of python 3.8.8 on my PC)

BTW, running the which python is giving me the following error (i think its supposed to work in linux) :

which : The term 'which' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ which python
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (which:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Thanks
Anantha Padmanabhan M Nair

The where command is the Windows equivalent of the which Unix command, you can try to run it to check that the python interpreter is actually the same.

Try to call thisroot.bat in vscode before launching the kernel as explained here.

Thank you for your time.
I have installed ROOT in UBUNTU 22.04 and its working fine with Jupyter. However, the python on my Linux is 3.10 and ROOT works fine but it dosent with python 3.10 in windows. Why does the “import ROOT” shows error when i use it with python 3.10 on windows? Can anyone please explain what should i do? Also, on windows, both the interpreters are same (3.8.8). (It just dosent work with python 3.10 in windows)

Even after calling thisroot.bat, the same error (kernel has crashed…) is showing in windows.

Thank You,
Anantha Padmanabhan M Nair

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