Thank you for the info.
To my understanding ROOT is compiled with ROOT 2.7, which would suit my case. I installed tensorflow and keras with pip2 (as python 2.7 should support tensorflow 1.15):
pip2 install tensorflow==1.15
pip2 install keras==2.2.4
However when I try to use pyTMVA the code crashes[1]. This does not happens if I install the latest versions tensorflow and keras with pip (not pip2).
[1]
>>> python2
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ROOT import TMVA, TFile, TTree, TCut
>>> from subprocess import call
>>> import sys
>>> import os
>>>
>>> import numpy
>>> import keras
Using TensorFlow backend.
>>> import h5py
>>>
>>> from keras.models import Sequential
>>> from keras.layers import Dense, Activation, Conv2D, MaxPooling2D, Flatten, Dropout
>>> from keras.regularizers import l2
>>> from keras.optimizers import SGD, Adam
>>> from keras.callbacks import ModelCheckpoint
>>>
>>> TMVA.Tools.Instance()
<cppyy.gbl.TMVA.Tools object at 0x564485895f70>
>>> TMVA.PyMethodBase.PyInitialize()
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
Thread 12 (Thread 0x7f8670b12700 (LWP 61561)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830f60 <thread_status+1376>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830f10 <thread_status+1296>, cond=0x7f8687830f38 <thread_status+1336>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830f38 <thread_status+1336>, mutex=0x7f8687830f10 <thread_status+1296>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 11 (Thread 0x7f8673313700 (LWP 61560)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830ee0 <thread_status+1248>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830e90 <thread_status+1168>, cond=0x7f8687830eb8 <thread_status+1208>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830eb8 <thread_status+1208>, mutex=0x7f8687830e90 <thread_status+1168>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 10 (Thread 0x7f8675b14700 (LWP 61559)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830e60 <thread_status+1120>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830e10 <thread_status+1040>, cond=0x7f8687830e38 <thread_status+1080>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830e38 <thread_status+1080>, mutex=0x7f8687830e10 <thread_status+1040>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 9 (Thread 0x7f8678315700 (LWP 61558)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830de0 <thread_status+992>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830d90 <thread_status+912>, cond=0x7f8687830db8 <thread_status+952>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830db8 <thread_status+952>, mutex=0x7f8687830d90 <thread_status+912>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 8 (Thread 0x7f867cb16700 (LWP 61557)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830d60 <thread_status+864>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830d10 <thread_status+784>, cond=0x7f8687830d38 <thread_status+824>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830d38 <thread_status+824>, mutex=0x7f8687830d10 <thread_status+784>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 7 (Thread 0x7f867d317700 (LWP 61556)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830ce0 <thread_status+736>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830c90 <thread_status+656>, cond=0x7f8687830cb8 <thread_status+696>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830cb8 <thread_status+696>, mutex=0x7f8687830c90 <thread_status+656>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 6 (Thread 0x7f8685b18700 (LWP 61555)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830c60 <thread_status+608>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830c10 <thread_status+528>, cond=0x7f8687830c38 <thread_status+568>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830c38 <thread_status+568>, mutex=0x7f8687830c10 <thread_status+528>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 5 (Thread 0x7f86da126700 (LWP 61554)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830be0 <thread_status+480>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830b90 <thread_status+400>, cond=0x7f8687830bb8 <thread_status+440>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830bb8 <thread_status+440>, mutex=0x7f8687830b90 <thread_status+400>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 4 (Thread 0x7f86d7925700 (LWP 61553)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830b60 <thread_status+352>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830b10 <thread_status+272>, cond=0x7f8687830b38 <thread_status+312>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830b38 <thread_status+312>, mutex=0x7f8687830b10 <thread_status+272>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 3 (Thread 0x7f86d5124700 (LWP 61552)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830ae0 <thread_status+224>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830a90 <thread_status+144>, cond=0x7f8687830ab8 <thread_status+184>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830ab8 <thread_status+184>, mutex=0x7f8687830a90 <thread_status+144>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 2 (Thread 0x7f86d2923700 (LWP 61551)):
#0 futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f8687830a60 <thread_status+96>) at ../sysdeps/nptl/futex-internal.h:183
#1 __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x7f8687830a10 <thread_status+16>, cond=0x7f8687830a38 <thread_status+56>) at pthread_cond_wait.c:508
#2 __pthread_cond_wait (cond=0x7f8687830a38 <thread_status+56>, mutex=0x7f8687830a10 <thread_status+16>) at pthread_cond_wait.c:638
#3 0x00007f8685e2c5eb in blas_thread_server () from /home/alberto/.local/lib/python2.7/site-packages/scipy/linalg/../.libs/libopenblasp-r0-2ecf47d5.3.7.dev.so
#4 0x00007f87003ac609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#5 0x00007f87004e8293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 1 (Thread 0x7f8700228740 (LWP 61501)):
#0 0x00007f87004abdff in __GI___wait4 (pid=61566, stat_loc=stat_loc
entry=0x7fffd0baa1c8, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1 0x00007f87004abd7b in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7fffd0baa1c8, options=options
entry=0) at waitpid.c:38
#2 0x00007f870041b0e7 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3 0x00007f86feee117e in TUnixSystem::StackTrace() () from /opt/root/lib/libCore.so
#4 0x00007f86ff15b2d2 in (anonymous namespace)::TExceptionHandlerImp::HandleException(int) () from /opt/root/lib/libcppyy_backend2_7.so
#5 0x00007f86feedde79 in TUnixSystem::DispatchSignals(ESignals) () from /opt/root/lib/libCore.so
#6 <signal handler called>
#7 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:304
#8 0x000056447bf85d09 in ?? ()
#9 0x000056447bf1e1b2 in PyEval_EvalFrameEx ()
#10 0x000056447bf362f6 in ?? ()
#11 0x000056447befd54f in PyObject_CallFunction ()
#12 0x000056447befac8d in PyImport_Import ()
#13 0x00007f8667c7e85c in TMVA::PyMethodBase::PyInitialize() () from /opt/root/lib/libPyMVA.so
#14 0x00007f86e313b023 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum https://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#7 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:304
#8 0x000056447bf85d09 in ?? ()
#9 0x000056447bf1e1b2 in PyEval_EvalFrameEx ()
#10 0x000056447bf362f6 in ?? ()
#11 0x000056447befd54f in PyObject_CallFunction ()
#12 0x000056447befac8d in PyImport_Import ()
#13 0x00007f8667c7e85c in TMVA::PyMethodBase::PyInitialize() () from /opt/root/lib/libPyMVA.so
#14 0x00007f86e313b023 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cppyy.ll.SegmentationViolation: static void TMVA::PyMethodBase::PyInitialize() =>
SegmentationViolation: segfault in C++; program state was reset