본문 바로가기
리빙포인트

(Tips) PyROOT install in windows10 (for ROOT v6.26.00)

by amAToRoi 2022. 3. 28.
반응형

There are 2 tips for windows10 user who are facing below errors after installing ROOT through "msi installer".

>>> import ROOT
Error code 1
  Traceback (most recent call last): File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'ROOT'
>>> import ROOT
Error code 2
ImportError: Failed to import libcppyy3_8. Please check that ROOT has been built for Python 3.8

 

Solution 1(for Error code 1): set environments for executing "thisroot.bat" in %ROOTSYS%\bin\ folder.
For example, go to C:\root_v6.26.00\bin\ and, execute thisroot.bat. It will set %ROOTSYS%, %PATH%, %PYTHONPATH% etc.. You can findout this batch file(thisroot.bat) in C:\"where you installed"\bin.

For example,
> C:\root_v6.26.00\bin\thisroot.bat  ↵ 
** Caution: this solution performs in Command Prompt(CMD) environment.

More details ...
%ROOTSYS% should be like "C:\root_v6.26.00" where you installed.
%PYTHONPATH% should be like "C:\root_v6.26.00\bin".

 

Solution 2(for Error code 2): install python verseion 3.8 32 bit(for me, Python 3.8.8rc1 which is for 32bit) .
"32bit" is most important factor to use PyROOT. ROOT is offering python libraries but pre-compiled version using 32 bit compiler(I guess).

You can findout libcppyy3_8.pyd(essential DLL for PyROOT) in %ROOTSYS%\bin. But it will work only when you install "python version 3.8 for 32bit". This does not mean you have to prepare 32bit windows. My windows10 is 64bit.

** Caution: In case the name of the DLL in %ROOTSYS%\bin like libcppyy3_7.pyd, follow the version of the name on it.

반응형

댓글