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
273 stars 137 forks source link

Dependency incompatibility in 1.55.1 in NEW conda env #245

Open florianduclot opened 1 year ago

florianduclot commented 1 year ago

Describe the bug In Windows 10, under a new conda env, simba fails to start with:

(...)
ImportError: cannot import name '_OneToOneFeatureMixin'

To Reproduce Steps to reproduce the behavior:

  1. conda create --name simbaenv python=3.6
  2. conda activate simbaenv
  3. pip install simba-uw-tf-dev
  4. pip install numba==0.52.0
  5. pip uninstall shapely
  6. conda install -c conda-forge Shapely
  7. simba

Expected behavior Simba starts successfully.

Desktop (please complete the following information):

Additional context From a little excursion down the rabbit hole of dependencies, it seems this stems from pip pulling a version of imbalanced-learn that is too new for the version of scikit-learn used by simba. I could fix it by ensuring imbalanced-learn==0.7.0 is installed. With the following packages, simba starts:


(simbaenv) C:\Users\florian.duclot>pip show simba-uw-tf-dev scikit-learn imbalanced-learn numba
Name: Simba-UW-tf-dev
Version: 1.55.1
Summary: Toolkit for computer classification of complex social 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 Lesser General Public License v3 (LGPLv3)
Location: c:\users\florian.duclot\appdata\local\continuum\anaconda3\envs\simbaenv\lib\site-packages
Requires: Pillow, opencv-python, numpy, numexpr, plotly, scipy, dtreeviz, dash-html-components, xgboost, tables, pandas, scikit-image, tqdm, matplotlib, cefpython3, h5py, xlrd, dash, imblearn, dash-core-components, numba, yellowbrick, graphviz, statsmodels, eli5, seaborn, wxpython, imgaug, dash-colorscales, dash-color-picker, pyarrow, imutils, shap, shapely, scikit-learn, pyyaml, trafaret, tabulate
Required-by:
---
Name: scikit-learn
Version: 0.22.2
Summary: A set of python modules for machine learning and data mining
Home-page: http://scikit-learn.org
Author: None
Author-email: None
License: new BSD
Location: c:\users\florian.duclot\appdata\local\continuum\anaconda3\envs\simbaenv\lib\site-packages
Requires: scipy, numpy, joblib
Required-by: yellowbrick, Simba-UW-tf-dev, shap, imbalanced-learn, eli5, dtreeviz
---
Name: imbalanced-learn
Version: 0.7.0
Summary: Toolbox for imbalanced dataset in machine learning.
Home-page: https://github.com/scikit-learn-contrib/imbalanced-learn
Author: None
Author-email: None
License: MIT
Location: c:\users\florian.duclot\appdata\local\continuum\anaconda3\envs\simbaenv\lib\site-packages
Requires: numpy, scikit-learn, joblib, scipy
Required-by: imblearn
---
Name: numba
Version: 0.52.0
Summary: compiling Python code using LLVM
Home-page: https://numba.github.com
Author: Anaconda, Inc.
Author-email: numba-users@continuum.io
License: BSD
Location: c:\users\florian.duclot\appdata\local\continuum\anaconda3\envs\simbaenv\lib\site-packages
Requires: llvmlite, setuptools, numpy
Required-by: Simba-UW-tf-dev

On the topic: is Python 3.6 still required or would a newer be recommended now (the installation docs seem to insist on 3.6)?

sronilsson commented 1 year ago

Thank you @florianduclot ! I will pin imblearn to 0.7.0 for now. SimBA relies on imblearn for SMOTE and SMOTEEN, however, the practical usefulness of those methods are questionable. We should probably get rid of imblearn as some point.

I have run it up to 3.8 without problems, I don't think there would be issues in 3.9. The code is developed in 3.6 env though, and not tested in any other version. So there could be some dependency tinkering before it boots up in >3.6.

florianduclot commented 1 year ago

Sounds good, and thanks a lot for the additional and helpful information!