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
279 stars 138 forks source link

Error after starting simba: unable to load classification from database #164

Open CorinneAKelly opened 2 years ago

CorinneAKelly commented 2 years ago

Describe the bug I am able to start simba and the GUI opens fine. If I try to create a new project and click "browse folder", the following error occurs:

2022-01-28 15:06:19,769 ERROR - Unable to load classification from database with name and id (Classification icon creation failed): Critical (8c70e164-91e6-4a6d-ad34-2f666638f911)
2022-01-28 15:06:19,769 ERROR - Unable to load classification from database with name and id (Classification icon creation failed): Confidential (eaa2d927-97cb-4f11-88e5-a2c37da0ccb7)
2022-01-28 15:06:19,771 ERROR - Unable to load classification from database with name and id (Classification icon creation failed): Restricted (a830f72f-36ba-41f9-9291-6c84f61a2cd4)
2022-01-28 15:06:19,772 ERROR - Unable to load classification from database with name and id (Classification icon creation failed): Public (c2f6427c-815b-4af1-bfc9-1df88e2297d6)
2022-01-28 15:06:19,773 ERROR - Monitor initialization failed with error 80070002 (1). Automatic configuration updates will not be received

If I continue anyway, and click "generate project config", it will successfully make a project folder but many of the files that should be inside it (such as the project_bp_names.csv) are missing. This makes me unable to either load in H5 files or even load the project itself if I exit simba and come back. Both of those cases lead to the following error:

Exception in Tkinter callback
Traceback (most recent call last):
  File "c:\users\ckelly\anaconda3\envs\simba\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "c:\users\ckelly\anaconda3\envs\simba\lib\site-packages\simba\SimBA.py", line 3268, in importh5
    importMultiDLCpose(self.configinifile,self.h5path.folder_path,self.dropdowndlc.getChoices(),idlist, self.interpolation.getChoices())
  File "c:\users\ckelly\anaconda3\envs\simba\lib\site-packages\simba\read_DLCmulti_h5_function.py", line 84, in importMultiDLCpose
    Xcols, Ycols, Pcols = getBpNames(inifile)
  File "c:\users\ckelly\anaconda3\envs\simba\lib\site-packages\simba\drop_bp_cords.py", line 129, in getBpNames
    poseConfigDf = pd.read_csv(bodyparthListPath, header=None)
  File "c:\users\ckelly\anaconda3\envs\simba\lib\site-packages\pandas\io\parsers.py", line 685, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "c:\users\ckelly\anaconda3\envs\simba\lib\site-packages\pandas\io\parsers.py", line 457, in _read
    parser = TextFileReader(fp_or_buf, **kwds)
  File "c:\users\ckelly\anaconda3\envs\simba\lib\site-packages\pandas\io\parsers.py", line 895, in __init__
    self._make_engine(self.engine)
  File "c:\users\ckelly\anaconda3\envs\simba\lib\site-packages\pandas\io\parsers.py", line 1135, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "c:\users\ckelly\anaconda3\envs\simba\lib\site-packages\pandas\io\parsers.py", line 1917, in __init__
    self._reader = parsers.TextReader(src, **kwds)
  File "pandas/_libs/parsers.pyx", line 382, in pandas._libs.parsers.TextReader.__cinit__
  File "pandas/_libs/parsers.pyx", line 689, in pandas._libs.parsers.TextReader._setup_parser_source
FileNotFoundError: [Errno 2] File b'C:/Users/ckelly/Desktop/SocialPrelim\\Simba1\\project_folder\\logs\\measures\\pose_configs\\bp_names\\project_bp_names.csv' does not exist: b'C:/Users/ckelly/Desktop/SocialPrelim\\Simba1\\project_folder\\logs\\measures\\pose_configs\\bp_names\\project_bp_names.csv'

Desktop (please complete the following information):

Additional context I have tried creating a new environment and installing simba from scratch, both with pip install simba-uw-tf-dev and pip install simba-uw-tf-dev --no-deps. Neither solved the issue. I found someone having a similar error to the second one I pasted above in the gitter, but it appeared their issue was due to path issues with Linux on a server. My error isn't with the path, the file it is looking for just doesn't exist. Any help would be greatly appreciated!

CorinneAKelly commented 2 years ago

I have also tried running this on my laptop just now with similar issues. For some reason on that computer I don't get the first string of classification errors, but I am still getting the second set of errors when I attempt to import DLC H5 files.

KonradDanielewski commented 2 years ago

I also have this issue when trying to use preset multianimal 2 animals/14 bps. bp_names is not created causing errors further down the line. Workaround for now is to just modify the analysis results so they will look like those from a single animal project for 2 animals/14 bps. Just wondering what's causing the issue

sgoldenlab commented 2 years ago

@KonradDanielewski - thanks for reporting, do you see any main terminal error msg when creating the project?

Also, I am correct that the settings you are the settings in this screenshot? Screen Shot 2022-03-07 at 6 27 59 AM

KonradDanielewski commented 2 years ago

Sorry, there is no error, neither in the main terminal nor in the simba terminal. Just the file not being created.

So, for now with the workaround I do set it the way you show with classic tracking and 2 animals, 14 bps and the project_bp_names.csv is being created. But when I change classic tracking to Multi tracking and Multi-animals, 7 bps it's not being created.

sgoldenlab commented 2 years ago

Thanks @KonradDanielewski - I've sorted it, if you update to 0.90.4 it should work - but please let me know. There was a line in there basically saying if multi-animal 7bps == do not create project_bp_names.csv lol. I have no idea why a line like that would be in there, makes me a little uneasy, but I've commented it out for now and does not seem to cause any immediate issues.

KonradDanielewski commented 2 years ago

Thanks for the quick response. So, the file now is created but it looks the same as the one for classic tracking, listing 14 bps with _1 and _2. Is it how it's supposed to be?

Maybe it's my lack of understanding how the workflow goes concerning bp names. I'll take a look at the code and try to get a better understanding of the backend

sgoldenlab commented 2 years ago

Yes that sounds correct, the workflow isn't ideal but going back now and sorting the backend ensuring backwards compatibility is tricky and not a priority. What happens is that SimBA pulls the index from the selected bp configuration in the dropdown, and matches it with the row in the simba.pose_configurations.bp_names.bp_names.csv file, and the values in the relevant row in this file is used to create the project_bp_names.csv file in the project. If you create additional user-defined configurations, then those become appended as a new row in the simba.pose_configurations.bp_names.bp_names.csv file.