Random error with pyROOT in notebook on a Conda env

Hello Root expert,

I work on an analysis with pyroot and notebook into a Conda environnement (I have installed Conda from Homebrew and ROOT with Conda install) on my machine and I have something like a random issue with my ROOT. Concretely, I need to use RooDataSet/RooFit and sometimes when I run my code I obtain an error (which appear randomly on RooDataSet creation or with RooFit use) which speak about “None of the overloaded … (no debug info) … segmentation violation” ,please find attach one exemple of this output there
bug_output.txt (16,5 Ko) .

And the most trouble thing about this issue is that by restarting the kernel (several time if needed) I can finally manage to run my code without any issue … I really don’t understand this behavior. Is there someone which know this issue and/or able to help me to solve it ?


Please read tips for efficient and successful posting and posting code

_ROOT Version: 6.26.10
Platform: MacOS 13.1
Compiler: Not Provided


Hi @TristanM,

That is strange given that you state that, after a few Jupyter notebook kernel restarts, you manage to run exactly the same code. Just to gather a bit more information, have you tried running the code in a Python interpreter (no Jupyter)?

FYI, @jonas! Have you seen that problem before?

And most importantly, @TristanM, could you provide us with a minimal reproducer so that we can try to debug the problem?

Cheers,
J.

Hmm the output looks funny. There are lines like this:

[/opt/homebrew/Caskroom/miniforge/base/envs/zfit_xgb/lib/libcppyy_backend3_9.6.26.10.so] WrapperCall(long, unsigned long, void*, void*, void*) (no debug info)

Your environment looks like there a different version of cppyy is picked up, not the one inside ROOT, but another one you installed yourself.

My suspicion is that because of this other cppyy, the implicit conversion from a python list to RooArgSet doesn’t work. Can you try with a RooArgSet explicitly?

ROOT.RooDataSet.from_numpy(data={"mass": npsigmass}, variables=ROOT.RooArgSet(mass))

I think it should work then! But even if it does, I can’t guarantee that you won’t run into other problems because of this cppyy clash.

Maybe @vpadulan knows if it is expected that ROOT picks up an external cppyy or what to do about it.

Hi all, thanks for your answer concerning a way to reproduce my bug please find attach:

If the environnement doesn’t work, you can maybe forget the zfit part or follow this to install zfit into a Conda env:

  1. new conda environment with python 3.9.15
  2. install tensorflow, tensorflow_probability, scipy, uproot, iminuit with conda install -c conda-forge package_name
  3. install zfit via pip install zfit
  4. and then Conda install other packages

I have seen that the issue seems to appear sometimes but less often if I remove the part with the TH1 plotting before the fitting part.

When I fit before the TH1 plot the (rare comparing to before) error I have send me the same “no debug info” stuff but the first part of the error is a bit different:
TypeError: none of the 2 overloaded methods succeeded. Full details:
RooFitResult* RooAbsPdf::fitTo(RooAbsData& data, const RooCmdArg& arg1 = RooCmdArg::none(), const RooCmdArg& arg2 = RooCmdArg::none(), const RooCmdArg& arg3 = RooCmdArg::none(), const RooCmdArg& arg4 = RooCmdArg::none(), const RooCmdArg& arg5 = RooCmdArg::none(), const RooCmdArg& arg6 = RooCmdArg::none(), const RooCmdArg& arg7 = RooCmdArg::none(), const RooCmdArg& arg8 = RooCmdArg::none()) =>
SegmentationViolation: segfault in C++; program state was reset
RooFitResult* RooAbsPdf::fitTo(RooAbsData& data, const RooLinkedList& cmdList) =>
TypeError: takes at least 2 arguments (1 given)

Hi,
Yes, the fact that another cppyy is picked up is troubling and it shouldn’t happen. Make sure that’s solved before anything else. Regarding the segfault issue, the two possible routes for debugging are trying with an easier example like Jonas was suggesting or writing the reproducer in C++. But there’s a good chance fixing the cppyy issue will already be enough.
Vincenzo

Hi @vpadulan, thanks for your answer. Do you have an idea about the way to follow in order to solve this cppyy issue ?

Hi @TristanM,

See also this post ROOT build with Python 3.7 in centos7 - #8 by vpadulan.

Cheers,
J.

Hi @TristanM,

I would try to make sure I have one, single, unique, coherent Python environment. All packages you need should be installed together (i.e. in the same conda create command). No mixing of pip and conda. For example I see you did this in point 3 of another comment of yours above. I would discourage you from doing this in general.
Cheers,
Vincenzo

Hello everyone, w.r.t. what you have said, I have decided to delete my Conda (miniforge) with all of its env and to reinstall a new Conda (miniconda) where I have redo env with a single conda create command (e.g. no more env with zfit). The problem appears less often now but it still happen sometimes …