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
286 stars 139 forks source link

Could it be possible to run SimBA on google Colab? #116

Closed Virginia9733 closed 3 years ago

Virginia9733 commented 3 years ago

Hi,

Since I do not have a GPU on my laptop, could it be possible to run Simba on google Colab? Or could I run it on a laptop without GPU?

I am using macOS Catalina 10.15.7.

I have tried to install SimBA on both macOS and windows, however, there was error messages regarding the GPU.

In macOS, when I run pip install simba-uw-tf

I got: Could not find a version that satisfies the requirement tensorflow-gpu==1.14.0 (from simba-uw-tf) (from versions: ) No matching distribution found for tensorflow-gpu==1.14.0 (from simba-uw-tf)

However, on Windows, I could successfully install Simba in conda env, but could not run it. The error message is:

ImportError: Could not find 'nvcuda.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Typically it is installed in 'C:\Windows\System32'. If it is not present, ensure that you have a CUDA-capable GPU with the correct driver installed.

sgoldenlab commented 3 years ago

Hi @Virginia9733 - if you are running SimBA on a Mac, you will have to use the simba-uw-tf-dev version. You can install it via pip install simba-uw-tf-dev.

Despite the tf in the package name, simba-uw-tf-dev does not use TensorFlow, and does not support the in-built DLC interface or the in-built DeepPoseKit interface.

Therefor, you will have to generate your pose-estimation inside the pose-estimation packages and their interfaces (for example DLC on colab) - and then import the analyzed CSV or H5 files into the SimBA project created by the simba-uw-tf-dev package.

Let me know if that makes sense!

Virginia9733 commented 3 years ago

Thank you for your reply. I tried to install simba-uw-tf-dev in macOS (macOS Catalina 10.15.7, withouth GPU), but still got the error message: (base) VirginiaLideMacBook-Air:~ virginiali$ conda activate simbaenv (simbaenv) VirginiaLideMacBook-Air:~ virginiali$ pip install simba-uw-tf-dev Collecting simba-uw-tf-dev Using cached https://files.pythonhosted.org/packages/dc/f7/9106e8a4ed067af1cf9e62016aabf236507c17af84ab7010f8072da0c9bd/Simba_UW_tf_dev-0.84.2-py3-none-any.whl Collecting yellowbrick==0.9.1 (from simba-uw-tf-dev) Using cached https://files.pythonhosted.org/packages/d8/e8/125204ea84a7424a3237556e8dfaec9fee21f2e3d5b3695eb9ce355bf668/yellowbrick-0.9.1-py2.py3-none-any.whl Collecting opencv-python==3.4.5.20 (from simba-uw-tf-dev) Could not find a version that satisfies the requirement opencv-python==3.4.5.20 (from simba-uw-tf-dev) (from versions: 3.4.10.37, 3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.14.51, 3.4.14.53, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 4.5.2.52, 4.5.2.54) No matching distribution found for opencv-python==3.4.5.20 (from simba-uw-tf-dev) You are using pip version 19.0.1, however version 21.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command.

Then I tried to install simba-uw-tf-dev in windows (Windows 10 64-bit, without GPU.), I suppose I have successfully installed simba, but could not run it.

(simbaenv) C:\WINDOWS\system32>simba Traceback (most recent call last): File "w:\anaconda\anaconda3\envs\simbaenv\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "w:\anaconda\anaconda3\envs\simbaenv\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "W:\Anaconda\Anaconda3\envs\simbaenv\Scripts\simba.exe__main.py", line 4, in File "w:\anaconda\anaconda3\envs\simbaenv\lib\site-packages\simba\SimBA.py", line 45, in from simba.train_model_2 import * File "w:\anaconda\anaconda3\envs\simbaenv\lib\site-packages\simba\train_model_2.py", line 12, in from xgboost.sklearn import XGBClassifier File "C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost\init__.py", line 11, in from .core import DMatrix, Booster File "C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost\core.py", line 161, in _LIB = _load_lib() File "C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost\core.py", line 123, in _load_lib lib_paths = find_lib_path() File "C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost\libpath.py", line 48, in find_lib_path 'List of candidates:\n' + ('\n'.join(dll_path))) xgboost.libpath.XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path? List of candidates: C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost\xgboost.dll C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost../../lib/xgboost.dll C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost./lib/xgboost.dll w:\anaconda\anaconda3\envs\simbaenv\xgboost\xgboost.dll C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost../../windows/x64/Release/xgboost.dll C:\Users\yongz\AppData\Roaming\Python\Python36\site-packages\xgboost./windows/x64/Release/xgboost.dll

Virginia9733 commented 3 years ago

I have solved the error in windows, by copy the xgboost.dll into Python36\site-packages\xgboost\, then it works like a charm, I could open SimBA GUI now, extremely happy.

However, still no clues to deal with the macOS error. Besides, since it takes ages to run without GPU, is it possible to run SimBA on colab witout GUI?

Any helo would be much appreciated!

inoejj commented 3 years ago

Please try to download the latest simba (development version) and I believe the macOS issue should be fixed.

pip install simba-uw-tf-dev

I believe you can run Deeplabcut using colab. However, SimBA's model does not require tensorflow and will not require a GPU to train the model.