Problem to import ROOT in python3.12

Dear Experts:

I recently updated my system from Ubuntu 22.04 to 24.04, and recompile ROOT 6.28/06. However, the python3 was also updated accordingly to Python 3.12.3. Then when I use ROOT in python by “import ROOT”, got the python crashed. The first few lines of the error message show as bellow (the whole errer message is attached):

Python 3.12.3 (main, Jul 31 2024, 17:43:48) [GCC 13.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import uproot
import ROOT
python3: /usr/include/python3.12/cpython/classobject.h:40: PyObject* PyMethod_GET_SELF(PyObject*): Assertion `PyMethod_Check(meth)’ failed.
*** Break *** abort

===========================================================
There was a crash (kSigAbort).
This is the entire stack trace of all threads:

I compiled the ROOT by trying both ways:
-Dpython3=ON -DPYTHON_EXECUTABLE=/usr/bin/python3
and
-Dpython3=ON -DPYTHON_EXECUTABLE=/home/dxlin/.venvs/dxlin/bin/python3 -DCMAKE_BUILD_TYPE=Debug

Is there anyone had the similar experience? And how can I fix it?

Thanks a lot for any help in advance!

errorlog_python312_root628.txt (71.2 KB)


_ROOT Version:_6.28/06
_Platform:_Ubuntu 24.04
_Compiler:_c++ 13.2.0


Hi,

I am sorry to hear you stumbled on this issue. We build and test continuously on 24.04, it seems that something is going on with your setup.
Could you please check that you have a clean environment, either from the system or Conda?

Best,
D

Hi Danilo,

Thank you very much for your suggestion.
Maybe you are right, it’s not assured that there is a clean environment, since I have python 3.10.9 before the ubuntu upgraded. I will try to check it.

Somehow, when I switch it to python3.10 (reinstalled, it’s 3.10.15), this problem is temporally solved, and I can ust ROOT in python as usual.

Thanks and best!

Hi,

Thanks for sharing the solution - happy you managed to solve this!
Don’t hesitate to come back tot he Forum if you have more questions.

Cheers,
D

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