LArbys / LArCV

Liquid Argon Computer Vision
11 stars 9 forks source link

larcv python script crashes when larlite is configured #61

Closed drinkingkazu closed 7 years ago

drinkingkazu commented 7 years ago

I believe I see multiple reports on a crash due to larlite/larcv interfering each other....

A typical example is, I believe, supera.py and view_rgb.py

I would love to solve this (... in fact I thought I did). Please share crash case here and your setup. If it's a shared machine I have an account, that would be super.

I just tried my larcv/larlite installation @ nudot to use supera.py and it did not crash. But if you see it even @ nudot please post it here.

drinkingkazu commented 7 years ago

Erez has this problem w/ LArLite and ROOT 06.04.10


`In file included from input_line_42:23:
In file included from /Users/erezcohen/larlite/core/DataFormat/ChStatus.h:22:
In file included from /Users/erezcohen/larlite/core/DataFormat/data_base.h:18:
/Users/erezcohen/larlite/core/Base/DataFormatConstants.h:116:39: error: use of undeclared identifier
      'kDATA_TYPE_MAX'
    const std::string kDATA_TREE_NAME[kDATA_TYPE_MAX] = {
                                      ^
In file included from input_line_42:23:
In file included from /Users/erezcohen/larlite/core/DataFormat/ChStatus.h:22:
In file included from /Users/erezcohen/larlite/core/DataFormat/data_base.h:19:
/Users/erezcohen/larlite/core/DataFormat/larlite_dataformat_utils.h:51:59: error: no member named 'kDATA_TYPE_MAX'
      in namespace 'larlite::data'
    product_id(const unsigned short type = larlite::data::kDATA_TYPE_MAX,
                                           ~~~~~~~~~~~~~~~^
In file included from input_line_42:23:
In file included from /Users/erezcohen/larlite/core/DataFormat/ChStatus.h:22:
/Users/erezcohen/larlite/core/DataFormat/data_base.h:36:43: error: no member named 'kDATA_TYPE_MAX' in namespace
      'larlite::data'
    data_base(unsigned short type = data::kDATA_TYPE_MAX);
                                    ~~~~~~^
/Users/erezcohen/larlite/core/DataFormat/data_base.h:66:45: error: no member named 'kDATA_TYPE_MAX' in namespace
      'larlite::data'
    output_base(unsigned short type = data::kDATA_TYPE_MAX,
                                      ~~~~~~^
/Users/erezcohen/larlite/core/DataFormat/data_base.h:170:47: error: no member named 'kDATA_TYPE_MAX' in namespace
      'larlite::data'
    event_base(unsigned short    type = data::kDATA_TYPE_MAX,
                                        ~~~~~~^
In file included from input_line_42:23:
/Users/erezcohen/larlite/core/DataFormat/ChStatus.h:67:66: error: no member named 'kChStatus' in namespace
      'larlite::data'
    event_chstatus(std::string name="noname") : event_base(data::kChStatus,name) { clear_data();}
                                                           ~~~~~~^
In file included from input_line_42:42:
/Users/erezcohen/larlite/core/DataFormat/Vertex.h:30:32: error: no member named 'kVertex' in namespace
      'larlite::data'
    vertex() : data_base(data::kVertex) {clear_data();}
                         ~~~~~~^
/Users/erezcohen/larlite/core/DataFormat/Vertex.h:71:64: error: no member named 'kVertex' in namespace
      'larlite::data'
    event_vertex(std::string name="noname") : event_base(data::kVertex,name) {clear_data();}
                                                         ~~~~~~^
Error in <TInterpreter::AutoParse>: Error parsing payload code for class larcv::IOManager with content:

#ifndef G__VECTOR_HAS_CLASS_ITERATOR
  #define G__VECTOR_HAS_CLASS_ITERATOR 1
#endif

#define _BACKWARD_BACKWARD_WARNING_H
#include "AABox2D.h"
#include "ChStatus.h"
#include "DataFormatTypes.h"
#include "DataFormatUtil.h"
#include "DataProductFactory.h"
#include "EventBase.h"
#include "EventChStatus.h"
#include "EventImage2D.h"
#include "EventPixel2D.h"
#include "EventROI.h"
#include "IOManager.h"
#include "Image2D.h"
#include "ImageMeta.h"
#include "LineSegment2D.h"
#include "Pixel2D.h"
#include "Pixel2DCluster.h"
#include "ProductMap.h"
#include "ROI.h"
#include "UtilFunc.h"
#include "Vector2D.h"
#include "Vertex.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

    [NORMAL]  <IOManager::prepare_input> Opening a file in READ mode: /Users/erezcohen/Desktop/uBoone/EXTBNB_DATA/larcv_files/larcv_9131runs_multipscore0.95_595evts_03082016.root
    [NORMAL]  <IOManager::initialize> Prepared input with 595 entries...
# self.dm
# Navigation box
No OpenCV. Disabling.`
drinkingkazu commented 7 years ago

Above problem is fixed by this commit: https://github.com/LArbys/LArCV/commit/6eea252e923cf45516226dea86e0696bd7b687dd

In general we should try "from larcv import larcv" and "from larlite import larlite" instead of "from ROOT import larcv" or "from ROOT import larlite" because auto-loading seems not correctly done in an order.

twongjirad commented 7 years ago

git pulled on larlite , rebuilt. git pulled on LArCV, removed build folder, rebuilt. I get the following on nudot:

taritree@nunet:~/working/larbys/LArCV/mac$ python view_rgb.py /mnt/raid0/taritree/v0/training_sample/validation_sample_overlay_v0.root Xlib: extension "XInputExtension" missing on display ":5.0". In file included from input_line_41:40: /home/taritree/working/larlite/core/Base/UtilFunc.h:8:27: error: no member named 'kDATA_TREE_NAME' in namespace 'larlite::data' return larlite::data::kDATA_TREE_NAME[t];


Error in TInterpreter::AutoParse: Error parsing payload code for class larcv::IOManager with content:

#ifndef G__VECTOR_HAS_CLASS_ITERATOR
  #define G__VECTOR_HAS_CLASS_ITERATOR 1
#endif

#define _BACKWARD_BACKWARD_WARNING_H
#include "AABox2D.h"
#include "ChStatus.h"
#include "DataFormatTypes.h"
#include "DataFormatUtil.h"
#include "DataProductFactory.h"
#include "EventBase.h"
#include "EventChStatus.h"
#include "EventImage2D.h"
#include "EventPixel2D.h"
#include "EventROI.h"
#include "Image2D.h"
#include "ImageMeta.h"
#include "IOManager.h"
#include "LineSegment2D.h"
#include "Pixel2DCluster.h"
#include "Pixel2D.h"
#include "ProductMap.h"
#include "ROI.h"
#include "UtilFunc.h"
#include "Vector2D.h"
#include "Vertex.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

```
[NORMAL]  <IOManager::prepare_input> Opening a file in READ mode: /mnt/raid0/taritree/v0/training_sample/validation_sample_overlay_v0.root
```

In file included from input_line_76:29:
/home/taritree/working/larbys/LArCV/core/DataFormat/EventImage2D.h:32:5: error: constructor
      for 'larcv::EventImage2D' must explicitly initialize the member '_image_v' which does
      not have a default constructor
    EventImage2D(){}
    ^
/home/taritree/working/larbys/LArCV/core/DataFormat/EventImage2D.h:60:33: note: member is
      declared here
    std::vectorlarcv::Image2D _image_v;
                                ^
/usr/include/c++/4.8/bits/stl_vector.h:210:11: note: 'std::vector<larcv::Image2D,
      std::allocator<larcv::Image2D> >' declared here
    class vector : protected _Vector_base<_Tp, _Alloc>
          ^
In file included from input_line_76:40:
/home/taritree/working/larlite/core/Base/UtilFunc.h:8:27: error: no member named
      'kDATA_TREE_NAME' in namespace 'larlite::data'
    return larlite::data::kDATA_TREE_NAME[t];
           ~~~~~~~~~~~~~~~^
In file included from input_line_7:1:
In file included from /home/taritree/software/root/include/Rtypes.h:223:
In file included from /home/taritree/software/root/include/TGenericClassInfo.h:15:
In file included from /usr/include/c++/4.8/vector:69:
/usr/include/c++/4.8/bits/vector.tcc:168:28: error: no member named '_S_always_equal' in
      '__gnu_cxx::__alloc_traitsstd::allocator<larcv::Image2D >'
              if (!_Alloc_traits::_S_always_equal()
                                  ^
/home/taritree/working/larbys/LArCV/core/DataFormat/EventImage2D.h:55:15: note: in
      instantiation of member function 'std::vector<larcv::Image2D,
      std::allocator<larcv::Image2D> >::operator=' requested here
    { image_v = std::move(_image_v); }
              ^
Error in TInterpreter::AutoParse: Error parsing payload code for class larcv::ChStatus with content:

#ifndef G__VECTOR_HAS_CLASS_ITERATOR
  #define G__VECTOR_HAS_CLASS_ITERATOR 1
#endif

#define _BACKWARD_BACKWARD_WARNING_H
#include "AABox2D.h"
#include "ChStatus.h"
#include "DataFormatTypes.h"
#include "DataFormatUtil.h"
#include "DataProductFactory.h"
#include "EventBase.h"
#include "EventChStatus.h"
#include "EventImage2D.h"
#include "EventPixel2D.h"
#include "EventROI.h"
#include "Image2D.h"
#include "ImageMeta.h"
#include "IOManager.h"
#include "LineSegment2D.h"
#include "Pixel2DCluster.h"
#include "Pixel2D.h"
#include "ProductMap.h"
#include "ROI.h"
#include "UtilFunc.h"
#include "Vector2D.h"
#include "Vertex.h"

#undef  _BACKWARD_BACKWARD_WARNING_H

Fatal: ! (prop&kIsClass) && "Impossible code path" violated at line 480 of `/home/taritree/software/root/io/io/src/TGenCollectionProxy.cxx'
aborting

Thread 3 (Thread 0x7f994d7fe700 (LWP 4237)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1  0x00000000004f4850 in ?? ()
#2  0x000000000049968d in PyEval_EvalFrameEx ()
#3  0x00000000004a1c9a in ?? ()
#4  0x0000000000505f96 in PyObject_Call ()
#5  0x000000000049b07a in PyEval_EvalFrameEx ()
#6  0x0000000000499ef2 in PyEval_EvalFrameEx ()
#7  0x0000000000499ef2 in PyEval_EvalFrameEx ()
#8  0x00000000004a1c9a in ?? ()
#9  0x00000000004dfe94 in ?? ()
#10 0x00000000004dc9cb in PyEval_CallObjectWithKeywords ()
#11 0x0000000000588b12 in ?? ()
#12 0x00007f999138f184 in start_thread (arg=0x7f994d7fe700) at pthread_create.c:312
#13 0x00007f99910bc37d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 2 (Thread 0x7f994ffff700 (LWP 4249)):
#0  0x00007f99910aefdd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f98bf589248 in ?? () from /lib/x86_64-linux-gnu/libusb-1.0.so.0
#2  0x00007f999138f184 in start_thread (arg=0x7f994ffff700) at pthread_create.c:312
#3  0x00007f99910bc37d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Thread 1 (Thread 0x7f999179c740 (LWP 4199)):
#0  0x00007f9991082a59 in __libc_waitpid (pid=4252, stat_loc=stat_loc
entry=0x7ffc742f1540, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:40
#1  0x00007f9991008232 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2  0x00007f98ed25ec93 in TUnixSystem::StackTrace() () from /home/taritree/software/root/lib/libCore.so
#3  0x00007f98ed1a4301 in DefaultErrorHandler(int, bool, char const_, char const_) () from /home/taritree/software/root/lib/libCore.so
#4  0x00007f98ed1a3d4a in ErrorHandler () from /home/taritree/software/root/lib/libCore.so
#5  0x00007f98ed1a41a2 in Fatal(char const_, char const_, ...) () from /home/taritree/software/root/lib/libCore.so
#6  0x00007f98ecc2113c in TGenCollectionProxy::Value::Value(std::string const&, bool) () from /home/taritree/software/root/lib/libRIO.so
#7  0x00007f98ecc21376 in R__CreateValue(std::string const&, bool) () from /home/taritree/software/root/lib/libRIO.so
#8  0x00007f98ecc219cf in TGenCollectionProxy::InitializeEx(bool) () from /home/taritree/software/root/lib/libRIO.so
#9  0x00007f98ecc1f2d7 in TGenCollectionProxy::GetCollectionType() const () from /home/taritree/software/root/lib/libRIO.so
#10 0x00007f98ed255a58 in TStreamerSTL::TStreamerSTL(char const_, char const_, int, char const_, TVirtualCollectionProxy const&, bool) () from /home/taritree/software/root/lib/libCore.so
#11 0x00007f98eccca01c in TStreamerInfo::Build() () from /home/taritree/software/root/lib/libRIO.so
#12 0x00007f98ed21fe51 in TClass::GetStreamerInfo(int) const () from /home/taritree/software/root/lib/libCore.so
#13 0x00007f98ecccdd9a in TStreamerInfo::BuildOld() () from /home/taritree/software/root/lib/libRIO.so
#14 0x00007f98ed21fd8d in TClass::GetStreamerInfo(int) const () from /home/taritree/software/root/lib/libCore.so
#15 0x00007f98ec896bd8 in TBranchElement::InitInfo() () from /home/taritree/software/root/lib/libTree.so
#16 0x00007f98ec899153 in TBranchElement::SetAddress(void_) () from /home/taritree/software/root/lib/libTree.so
#17 0x00007f98ec8ae541 in TChain::LoadTree(long long) () from /home/taritree/software/root/lib/libTree.so
#18 0x00007f98ec8acc06 in TChain::GetEntries() const () from /home/taritree/software/root/lib/libTree.so
#19 0x00007f9934013592 in larcv::IOManager::prepare_input (this=this
entry=0x6522ae0) at IOManager.cxx:350
#20 0x00007f9934016e3f in larcv::IOManager::initialize (this=0x6522ae0) at IOManager.cxx:145
#21 0x00007f99821eb036 in ?? ()
#22 0x0000000000000000 in ?? ()
Aborted (core dumped)
twongjirad commented 7 years ago

went into mac/ changed init.py

changed

import ROOT
from ROOT import larcv

to

import ROOT 
from larcv import larcv

fixed. will check in change to develop.

twongjirad commented 7 years ago

fixed in https://github.com/LArbys/LArCV/commit/c3a4bdb27b5331844ad99373e8aef3cd5742c6c8

proof that viewer works on nudot:

screen shot 2016-08-05 at 4 52 00 pm

twongjirad commented 7 years ago

list of everywhere 'from ROOT import larcv' occurs:

taritree@nunet:~/working/larbys/LArCV$ grep -iIr 'from ROOT import larcv' * app/PMTWeights/test_pmtweights.py:from ROOT import larcv, std app/PMTWeights/foo.py:from ROOT import larcv, std app/SmallSampleMaker/run.py:from ROOT import larcv, std app/CalibADC/run.py:from ROOT import larcv, std app/tests/test_matrixmult.py:from ROOT import larcv app/tests/test_eltwisemult.py:from ROOT import larcv app/ImageAna/run.py:from ROOT import larcv, std core/DataFormat/test/test_both.py:from ROOT import larcv mac/dump_pixels.py:from ROOT import larcv mac/dump_chstatus.py:from ROOT import larcv mac/dump_bb.py:from ROOT import larcv mac/dump_all_bb.py:from ROOT import larcv mac/mac/concat_roi.py:from ROOT import larcv python/larcv/init.py:from ROOT import larcv

i'm going to change them all.

drinkingkazu commented 7 years ago

THANK YOU!!!

twongjirad commented 7 years ago

done: 734a147a1e54832f1f9dd45cced1a47eed8c2ef2

assuming this fixes the error forever and closing the issue.