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

Error when installing Simba on Python 3.10 #379

Open leahsalinsky opened 1 month ago

leahsalinsky commented 1 month ago

Getting this error when trying to install simba. Have also tried downgrading pip and received a different error regarding the dependencies.

error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [81 lines of output] C:\Users\salinsky\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools__init__.py:85: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. !!

          ********************************************************************************
          Requirements should be satisfied by a PEP 517 installer.
          If you are using pip, you can try `pip install --use-pep517`.
          ********************************************************************************

  !!
    dist.fetch_build_eggs(dist.setup_requires)
  C:\Users\salinsky\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py:268: UserWarning: Unknown distribution option: 'test_suite'
    warnings.warn(msg)
  C:\Users\salinsky\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py:268: UserWarning: Unknown distribution option: 'tests_require'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-cpython-310
  creating build\lib.win-amd64-cpython-310\shap
  copying shap\common.py -> build\lib.win-amd64-cpython-310\shap
  copying shap\datasets.py -> build\lib.win-amd64-cpython-310\shap
  copying shap\__init__.py -> build\lib.win-amd64-cpython-310\shap
  creating build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\additive.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\bruteforce.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\explainer.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\gradient.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\kernel.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\linear.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\mimic.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\partition.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\permutation.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\pytree.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\sampling.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\tf_utils.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\tree.py -> build\lib.win-amd64-cpython-310\shap\explainers
  copying shap\explainers\__init__.py -> build\lib.win-amd64-cpython-310\shap\explainers
  creating build\lib.win-amd64-cpython-310\shap\explainers\other
  copying shap\explainers\other\coefficent.py -> build\lib.win-amd64-cpython-310\shap\explainers\other
  copying shap\explainers\other\lime.py -> build\lib.win-amd64-cpython-310\shap\explainers\other
  copying shap\explainers\other\maple.py -> build\lib.win-amd64-cpython-310\shap\explainers\other
  copying shap\explainers\other\random.py -> build\lib.win-amd64-cpython-310\shap\explainers\other
  copying shap\explainers\other\treegain.py -> build\lib.win-amd64-cpython-310\shap\explainers\other
  copying shap\explainers\other\__init__.py -> build\lib.win-amd64-cpython-310\shap\explainers\other
  creating build\lib.win-amd64-cpython-310\shap\explainers\deep
  copying shap\explainers\deep\deep_pytorch.py -> build\lib.win-amd64-cpython-310\shap\explainers\deep
  copying shap\explainers\deep\deep_tf.py -> build\lib.win-amd64-cpython-310\shap\explainers\deep
  copying shap\explainers\deep\__init__.py -> build\lib.win-amd64-cpython-310\shap\explainers\deep
  creating build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\bar.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\colorconv.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\colors.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\decision.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\dependence.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\embedding.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\force.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\force_matplotlib.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\image.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\monitoring.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\partial_dependence.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\summary.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\text.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\waterfall.py -> build\lib.win-amd64-cpython-310\shap\plots
  copying shap\plots\__init__.py -> build\lib.win-amd64-cpython-310\shap\plots
  creating build\lib.win-amd64-cpython-310\shap\benchmark
  copying shap\benchmark\experiments.py -> build\lib.win-amd64-cpython-310\shap\benchmark
  copying shap\benchmark\measures.py -> build\lib.win-amd64-cpython-310\shap\benchmark
  copying shap\benchmark\methods.py -> build\lib.win-amd64-cpython-310\shap\benchmark
  copying shap\benchmark\metrics.py -> build\lib.win-amd64-cpython-310\shap\benchmark
  copying shap\benchmark\models.py -> build\lib.win-amd64-cpython-310\shap\benchmark
  copying shap\benchmark\plots.py -> build\lib.win-amd64-cpython-310\shap\benchmark
  copying shap\benchmark\__init__.py -> build\lib.win-amd64-cpython-310\shap\benchmark
  creating build\lib.win-amd64-cpython-310\shap\plots\resources
  copying shap\plots\resources\bundle.js -> build\lib.win-amd64-cpython-310\shap\plots\resources
  copying shap\plots\resources\logoSmallGray.png -> build\lib.win-amd64-cpython-310\shap\plots\resources
  copying shap\tree_shap.h -> build\lib.win-amd64-cpython-310\shap
  running build_ext
  numpy.get_include() C:\Users\salinsky\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\include
  building 'shap._cext' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for shap Running setup.py clean for shap Failed to build shap ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (shap) A clear and concise description of what the bug is.

Desktop (please complete the following information):

Additional context plz help me

sronilsson commented 1 month ago

Hi @leahsalinsky !

I see! There are three things you could try:

i) Us python 3.6 rather than 3.10 - how does it run? ii) If you use a python 3.6 or python 3.10 environment in anaconda, does it work? iii) The error message is about some C++ build tools that is missing in your Microsoft Windows installation. You can install them and it should fix it. There is a detailed guide for how to install them HERE

Simon

leahsalinsky commented 1 month ago

Okay, so we tried iii), installing the C++ build tools and it appeared to have downloaded. However, when we type simba into the command prompt, we get this "'simba' is not recognized as an internal or external command, operable program or batch file."

sronilsson commented 1 month ago

That would mean simba isn't installed - is it possible that you are in an anaconda python environment or a different python environment where you haven't installed simba with pip install simba-uw-tf-dev?

What do you see if you run pip install simba-uw-tf-dev ?

leahsalinsky commented 1 month ago

We get a list of packages saying requirement already satisfied!

sronilsson commented 1 month ago

if you type pip show simba-uw-tf-dev what do you see printed?

leahsalinsky commented 1 month ago

We get this Name: Simba-UW-tf-dev Version: 2.0.7 Summary: Toolkit for computer classification and analysis of behaviors in experimental animals Home-page: https://github.com/sgoldenlab/simba Author: Simon Nilsson, Jia Jie Choong, Sophia Hwang Author-email: sronilsson@gmail.com License: GNU General Public License v3 (GPLv3) Location: c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages Requires: cefpython3, dash, dash-color-picker, dash-colorscales, dash-core-components, dash-html-components, dtreeviz, eli5, ffmpeg-python, geos, graphviz, h5py, imbalanced-learn, imgaug, imutils, joblib, kaleido, matplotlib, numba, numexpr, numpy, opencv-python, pandas, Pillow, plotly, psutil, pyarrow, pyglet, pyyaml, scikit-image, scikit-learn, scipy, seaborn, shap, shapely, statsmodels, tables, tabulate, tqdm, trafaret, xgboost, xlrd, yellowbrick Required-by:

sronilsson commented 1 month ago

That looks right.. hmm - but just to confirm again: typing simba does not work, would you mind sharing the output of what is printed out??

leahsalinsky commented 1 month ago

This is what I get!

'simba' is not recognized as an internal or external command, operable program or batch file.

sronilsson commented 1 month ago

What about if you uninstall it with pip uninstall simba-uw-tf-dev followed by reinstalling it with pip install simba-uw-tf-dev? In case something odd happened at the C++ tools installation.

leahsalinsky commented 1 month ago

SIMON! You gosh darn genius. As simple as that was, it worked!!!!

sronilsson commented 1 month ago

great, thanks @leahsalinsky - let me know if anything else comes up!

leahsalinsky commented 3 weeks ago

Hi Simon! Sorry to bother you again, but I was using Simba no problem, but then this morning when I tried to open it by typing simba into the command prompt as before, I started getting this C:\Users\salinsky\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.10>simba Traceback (most recent call last): File "c:\users\salinsky\appdata\local\programs\python\python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\salinsky\appdata\local\programs\python\python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\salinsky\AppData\Local\Programs\Python\Python310\Scripts\simba.exe__main.py", line 4, in File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\SimBA.py", line 21, in from simba.bounding_box_tools.boundary_menus import BoundaryMenus File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\bounding_box_tools\boundary_menus.py", line 9, in from simba.bounding_box_tools.agg_boundary_stats import \ File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\bounding_box_tools\agg_boundary_stats.py", line 14, in from simba.utils.data import detect_bouts, plug_holes_shortest_bout File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\utils\data.py", line 17, in from pylab import File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\pylab.py", line 1, in from matplotlib.pylab import File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib\pylab.py", line 35, in from matplotlib import cbook, mlab, pyplot as plt File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib\pyplot.py", line 2230, in switch_backend(rcParams["backend"]) File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib__init.py", line 672, in getitem__ plt.switch_backend(rcsetup._auto_backend_sentinel) File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib\pyplot.py", line 247, in switch_backend switch_backend(candidate) File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib\pyplot.py", line 267, in switch_backend class backend_mod(matplotlib.backend_bases._Backend): File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib\pyplot.py", line 268, in backend_mod locals().update(vars(importlib.import_module(backend_name))) File "c:\users\salinsky\appdata\local\programs\python\python310\lib\importlib\init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib\backends\backend_qtagg.py", line 12, in from .backend_qt import ( File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib\backends\backend_qt.py", line 73, in _MODIFIER_KEYS = [ File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\matplotlib\backends\backend_qt.py", line 74, in (_to_int(getattr(_enum("QtCore.Qt.KeyboardModifier"), mod)), TypeError: int() argument must be a string, a bytes-like object or a real number, not 'KeyboardModifier'

and as I am extremely not python savvy, I was wondering if you are able to understand what is happening here?

sronilsson commented 3 weeks ago

Hi @leahsalinsky!

Got it - this can happen when SimBA is installed in the main python (i.e., no dedicated conda or no python env) and some package or package version changes (in this case it seems to be matplotlib).

If you do pip show matplotlib what version do you see?

If you do not see version 3.5.0, can you do pip install matplotlib==3.5.0 and see if that fixes it?

leahsalinsky commented 3 weeks ago

So, it is showing version 3.5.0...

sronilsson commented 3 weeks ago

Alright - if you do pip show pyside6 do you see anything printed out?

leahsalinsky commented 3 weeks ago

I get this C:\Users\salinsky> pip show pyside6 Name: PySide6 Version: 6.4.2 Summary: Python bindings for the Qt cross-platform application and UI framework Home-page: https://www.pyside.org Author: Qt for Python Team Author-email: pyside@qt-project.org License: LGPL Location: c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages Requires: PySide6-Addons, PySide6-Essentials, shiboken6 Required-by:

sronilsson commented 3 weeks ago

can you do pip uninstall pyside6 -y and see if it it runs?

leahsalinsky commented 3 weeks ago

So, after doing that, I got this: C:\Users\salinsky>simba Traceback (most recent call last): File "c:\users\salinsky\appdata\local\programs\python\python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\salinsky\appdata\local\programs\python\python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\salinsky\AppData\Local\Programs\Python\Python310\Scripts\simba.exe__main.py", line 7, in sys.exit(main()) File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\SimBA.py", line 1086, in main SplashMovie() File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\SimBA.py", line 1059, in init__ self.show_animation() File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\SimBA.py", line 1072, in showanimation cv2.waitKey(max(33, int(self.meta["fps"] / 1000))) cv2.error: OpenCV(4.10.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1367: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'

sronilsson commented 3 weeks ago

Got it - there seems to be more packages that have changed versions.

If you do pip uninstall simba-uw-tf-dev followed by pip install simba-uw-tf-dev, how does it look?

leahsalinsky commented 3 weeks ago

I still get the same error as above... (i apologize for my severe lack of python knowledge.)

leahsalinsky commented 3 weeks ago

When uninstalling, it shows this, which seems a little weird to me: :\Users\salinsky>pip uninstall simba-uw-tf-dev Found existing installation: Simba-UW-tf-dev 2.0.7 Uninstalling Simba-UW-tf-dev-2.0.7: Would remove: c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages.ds_store c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba* c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba_uw_tf_dev-2.0.7.dist-info* c:\users\salinsky\appdata\local\programs\python\python310\scripts\simba.exe Would not remove (might be manually added): c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins__pycache\timeseries_features_mixin.TimeseriesFeatureMixin.percentile_difference-265.py310.1.nbc c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins__pycache\timeseries_features_mixin.TimeseriesFeatureMixin.percentile_difference-265.py310.nbi c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins__pycache\timeseries_features_mixin.TimeseriesFeatureMixin.petrosian_fractal_dimension-491.py310.1.nbc c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins__pycache\timeseries_features_mixin.TimeseriesFeatureMixin.petrosian_fractal_dimension-491.py310.nbi c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_descriptive_statistics-812.py310.1.nbc c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_descriptive_statistics-812.py310.nbi c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_percent_beyond_n_std-366.py310.1.nbc c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_percent_beyond_n_std-366.py310.nbi c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_percent_in_percentile_window-448.py310.1.nbc c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_percent_in_percentile_window-448.py310.nbi c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_percentile_difference-295.py310.1.nbc c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_percentile_difference-295.py310.nbi c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache__\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_petrosian_fractal_dimension-539.py310.1.nbc c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache__\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_petrosian_fractal_dimension-539.py310.nbi c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache__\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_variance-779.py310.1.nbc c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\mixins\pycache__\timeseries_features_mixin.TimeseriesFeatureMixin.sliding_variance-779.py310.nbi Proceed (Y/n)? Y Successfully uninstalled Simba-UW-tf-dev-2.0.7

sronilsson commented 3 weeks ago

Alright, the issue above is related to OpenCV. You should have version 4.8.1.78 but I think you have version 4.10 something now.

if you do pip install opencv-python==4.8.1.78 - how does it look?

leahsalinsky commented 3 weeks ago

This is what I get..

C:\Users\salinsky>pip install opencv-python==4.8.1.78 Requirement already satisfied: opencv-python==4.8.1.78 in c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages (4.8.1.78) Requirement already satisfied: numpy>=1.21.2 in c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages (from opencv-python==4.8.1.78) (1.26.4)

C:\Users\salinsky>simba Traceback (most recent call last): File "c:\users\salinsky\appdata\local\programs\python\python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\salinsky\appdata\local\programs\python\python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\salinsky\AppData\Local\Programs\Python\Python310\Scripts\simba.exe__main.py", line 7, in sys.exit(main()) File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\SimBA.py", line 1086, in main SplashMovie() File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\SimBA.py", line 1059, in init__ self.show_animation() File "c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages\simba\SimBA.py", line 1072, in showanimation cv2.waitKey(max(33, int(self.meta["fps"] / 1000))) cv2.error: OpenCV(4.10.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1367: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'

leahsalinsky commented 3 weeks ago

I have absolutely no idea how this happened

leahsalinsky commented 3 weeks ago

When i asked it to show OpenCV, the version seems correct: C:\Users\salinsky>pip show opencv-python Name: opencv-python Version: 4.8.1.78 Summary: Wrapper package for OpenCV python bindings. Home-page: https://github.com/opencv/opencv-python Author: Author-email: License: Apache 2.0 Location: c:\users\salinsky\appdata\local\programs\python\python310\lib\site-packages Requires: numpy Required-by: imgaug, Simba-UW-tf-dev

sronilsson commented 3 weeks ago

I don't know either, but chances are some other package, like deeplabcut or sleap or something else, was installed on this computer in the same python. And those packages have other dependencies.

You can try: pip uninstall opencv-python-headless and see how it goes?

leahsalinsky commented 3 weeks ago

So before you answered I tried C:\Users\salinsky> pip uninstall openCV-python==4.10 and then C:\Users\salinsky> pip install opencv-python==4.8.1.78 and now it opens!

sronilsson commented 3 weeks ago

ah nice, well played! 🚀

leahsalinsky commented 3 weeks ago

Hopefully I will not need to bother you again, but I make no promises. Thank you so much again!!!

sronilsson commented 3 weeks ago

No bother at all, we are all learning, and I am happy to help when I can!