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
287 stars 140 forks source link

NameError: name 'deeplabcut' is not defined #113

Closed Soengzaak closed 3 years ago

Soengzaak commented 3 years ago

Describe the bug Hi,thanks for your attention.I've just used SimBA,but I met this problem when I started the DLC software and popup this:

(simba) C:\Users\tearc>simba Exception in Tkinter callback Traceback (most recent call last): File "c:\users\tearc\anaconda3\envs\simba\lib\tkinter__init.py", line 1705, in call return self.func(*args) File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\simba\SimBA.py", line 1400, in createprojectcommand config_path = deeplabcut.create_new_project(str(projectname), str(experimentalname), videolist,working_directory=str(self.folderpath1selected.folder_path), copy_videos=copyvid) NameError: name 'deeplabcut' is not defined Exception in Tkinter callback Traceback (most recent call last): File "c:\users\tearc\anaconda3\envs\simba\lib\tkinter\init.py", line 1705, in call__ return self.func(*args) File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\simba\SimBA.py", line 1400, in createprojectcommand config_path = deeplabcut.create_new_project(str(projectname), str(experimentalname), videolist,working_directory=str(self.folderpath1selected.folder_path), copy_videos=copyvid) NameError: name 'deeplabcut' is not defined Exception ignored in: <simba.SimBA.StdRedirector object at 0x000001F5B49768D0> AttributeError: 'StdRedirector' object has no attribute 'flush'

After searched in this Issues,I entered 'pip install deeplabcut==2.0.9',and then there was another error and the SimBA even can not started!

(simba) C:\Users\tearc>simba Traceback (most recent call last): File "c:\users\tearc\anaconda3\envs\simba\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\tearc\anaconda3\envs\simba\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\tearc\anaconda3\envs\simba\Scripts\simba.exe__main.py", line 4, in File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\simba\SimBA.py", line 44, in from simba.train_multiple_models_from_meta import * File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\simba\train_multiple_models_from_meta.py", line 10, in from imblearn.combine import SMOTEENN File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\imblearn\init.py", line 34, in from . import combine File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\imblearn\combine\init.py", line 5, in from ._smote_enn import SMOTEENN File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\imblearn\combine_smote_enn.py", line 10, in from ..base import BaseSampler File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\imblearn\base.py", line 16, in from .utils import check_sampling_strategy, check_target_type File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\imblearn\utils\init__.py", line 7, in from ._validation import check_neighbors_object File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\imblearn\utils_validation.py", line 13, in from sklearn.neighbors._base import KNeighborsMixin ModuleNotFoundError: No module named 'sklearn.neighbors._base'

Do you have any ideas? Please help me ,thanks!

Desktop (please complete the following information):

sgoldenlab commented 3 years ago

Hi thank you for opening up an issue.

Please follow the steps below and see if that still gives you an error.

This will install SimBA with built in deeplabcut.

  1. Downgrade pip to version 19.0.1 by pip install pip==19.0.1
  2. Install simba tensorflow version, pip install simba-uw-tf==1.3.12
  3. It will error out because of shapely. Uninstall shapely by pip uninstall shapely
  4. Then reinstall shapely with conda command: conda install -c conda-forge shapely
Soengzaak commented 3 years ago

Hi thank you for opening up an issue.

Please follow the steps below and see if that still gives you an error.

This will install SimBA with built in deeplabcut.

  1. Downgrade pip to version 19.0.1 by pip install pip==19.0.1
  2. Install simba tensorflow version, pip install simba-uw-tf==1.3.12
  3. It will error out because of shapely. Uninstall shapely by pip uninstall shapely
  4. Then reinstall shapely with conda command: conda install -c conda-forge shapely

Thanks for your reply :) I did as you said but the SimBA was still unable to started and then popuped an error like this:

Traceback (most recent call last):
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
    ctypes.WinDLL(build_info.cudart_dll_name)
  File "c:\users\tearc\anaconda3\envs\simba\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\tearc\anaconda3\envs\simba\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\tearc\anaconda3\envs\simba\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\tearc\anaconda3\envs\simba\Scripts\simba.exe\__main__.py", line 5, in <module>
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\simba\SimBA.py", line 8, in <module>
    import deeplabcut
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\deeplabcut\__init__.py", line 29, in <module>
    from deeplabcut import generate_training_dataset
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\deeplabcut\generate_training_dataset\__init__.py", line 19, in <module>
    from deeplabcut.generate_training_dataset.labeling_toolbox import *
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\deeplabcut\generate_training_dataset\labeling_toolbox.py", line 27, in <module>
    from deeplabcut.utils import auxiliaryfunctions
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\deeplabcut\utils\__init__.py", line 1, in <module>
    from deeplabcut.utils.make_labeled_video import *
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\deeplabcut\utils\make_labeled_video.py", line 38, in <module>
    from deeplabcut.pose_estimation_tensorflow.config import load_config
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\deeplabcut\pose_estimation_tensorflow\__init__.py", line 13, in <module>
    from deeplabcut.pose_estimation_tensorflow.nnet import *
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\deeplabcut\pose_estimation_tensorflow\nnet\__init__.py", line 14, in <module>
    from deeplabcut.pose_estimation_tensorflow.nnet.losses import *
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\deeplabcut\pose_estimation_tensorflow\nnet\losses.py", line 5, in <module>
    import tensorflow as tf
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
    self_check.preload_check()
  File "c:\users\tearc\anaconda3\envs\simba\lib\site-packages\tensorflow\python\platform\self_check.py", line 82, in preload_check
    % (build_info.cudart_dll_name, build_info.cuda_version_number))
ImportError: Could not find 'cudart64_100.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 10.0 from this URL: https://developer.nvidia.com/cuda-90-download-archive.

I have just guested maybe I need to install CUDA Runtime therefore I downloaded it from the website above and had installed it .However it popuped this error again in the Anacoda ,maybe I need to set the PATH?But how todo it.Please help me ,thank you!

sgoldenlab commented 3 years ago

Hello @Soengzaak! This is cudnn related. We are trying to move away from supporting pose-estimation within SimBA. To fix this, either:

Soengzaak commented 3 years ago

Hello @Soengzaak! This is cudnn related. We are trying to move away from supporting pose-estimation within SimBA. To fix this, either:

  • Use simba-uw-tf-dev instead of simba-uw-tf and do the pose-estimation through the DLC or other pose-estimation interface, not within the SimBA GUI.
  • Make sure you have compatible versions of cudnn and CUDA installed - there are some notes to help get the right versions installed HERE and HERE

Many thanks to you!I reset up the PATH and finally sovled it .Now I can started the software normally,thanks you! XD