sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
288 stars 140 forks source link

RuntimeError: main thread is not in main loop #20

Closed JensBlack closed 4 years ago

JensBlack commented 4 years ago

Describe the bug When training a model using the app function "train single model from global environment" the following Error popt up. It seems to be connected to yellowbrick (so reporting?) but messes with the functionality. The model will not be saved (even though it was successfully trained).

This is the simba report window

grafik

This is the console until the error

grafik

This is the error message

Exception in thread Thread-182:
Traceback (most recent call last):
  File "D:\Anaconda\envs\simba-gpu\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "D:\Anaconda\envs\simba-gpu\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "simba.py", line 3726, in trainsinglemodel
    trainmodel2(self.projectconfigini)
  File "C:\Users\schwa\PycharmProjects\simba\simba\train_model_2.py", line 290, in trainmodel2
    generateClassificationReport(clf, class_names)
  File "C:\Users\schwa\PycharmProjects\simba\simba\train_model_2.py", line 68, in generateClassificationReport
    g = visualizer.poof(outpath=visualizerPath, clear_figure=True)
  File "D:\Anaconda\envs\simba-gpu\lib\site-packages\yellowbrick\base.py", line 215, in poof
    plt.savefig(outpath, **kwargs)
  File "D:\Anaconda\envs\simba-gpu\lib\site-packages\matplotlib\pyplot.py", line 690, in savefig
    fig.canvas.draw_idle()   # need this if 'transparent=True' to reset colors
  File "D:\Anaconda\envs\simba-gpu\lib\site-packages\matplotlib\backends\_backend_tk.py", line 350, in draw_idle
    self._idle_callback = self._tkcanvas.after_idle(idle_draw)
  File "D:\Anaconda\envs\simba-gpu\lib\tkinter\__init__.py", line 764, in after_idle
    return self.after('idle', func, *args)
  File "D:\Anaconda\envs\simba-gpu\lib\tkinter\__init__.py", line 756, in after
    name = self._register(callit)
  File "D:\Anaconda\envs\simba-gpu\lib\tkinter\__init__.py", line 1372, in _register
    self.tk.createcommand(name, f)
RuntimeError: main thread is not in main loop

Desktop (please complete the following information): Simba GPU installation (Anaconda) on Windows 10

Additional context A restart of the whole procedure went completely smooth without any errors. No restart necessary or anything. Just clicked the button again.

inoejj commented 4 years ago

@JensBlack , I think this is a threading issue. Let me know if this happens again and I will redesign the code.