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

Issue with scikit-learn when installing SimBA #187

Closed autumnca closed 2 years ago

autumnca commented 2 years ago

The only package error I get when trying to install SimBA involves scikit-learn, and I was initially presented with an error telling me that I did not have scikit-learn installed, and that I needed version 0.22.2, so I installed that here:

(simbaenv) C:\Users\adae-lab-admin>pip install scikit-learn==0.22.2 Collecting scikit-learn==0.22.2 Using cached scikit_learn-0.22.2-cp36-cp36m-win_amd64.whl (6.5 MB) Requirement already satisfied: joblib>=0.11 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn==0.22.2) (1.1.0) Requirement already satisfied: scipy>=0.17.0 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn==0.22.2) (1.1.0) Requirement already satisfied: numpy>=1.11.0 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn==0.22.2) (1.18.1) Installing collected packages: scikit-learn Attempting uninstall: scikit-learn Found existing installation: scikit-learn 0.24.2 Uninstalling scikit-learn-0.24.2: Successfully uninstalled scikit-learn-0.24.2 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. imbalanced-learn 0.8.1 requires scikit-learn>=0.24, but you have scikit-learn 0.22.2 which is incompatible. Successfully installed scikit-learn-0.22.2

And then I was presented with an error saying I needed >= version 0.24. After installing that, I'm presented with an error saying I need 0.22.2.

(simbaenv) C:\Users\adae-lab-admin>pip install scikit-learn==0.24.2 Collecting scikit-learn==0.24.2 Using cached scikit_learn-0.24.2-cp36-cp36m-win_amd64.whl (6.8 MB) Requirement already satisfied: scipy>=0.19.1 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn==0.24.2) (1.1.0) Requirement already satisfied: numpy>=1.13.3 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn==0.24.2) (1.18.1) Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn==0.24.2) (3.1.0) Requirement already satisfied: joblib>=0.11 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn==0.24.2) (1.1.0) Installing collected packages: scikit-learn Attempting uninstall: scikit-learn Found existing installation: scikit-learn 0.22.2 Uninstalling scikit-learn-0.22.2: Successfully uninstalled scikit-learn-0.22.2 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. simba-uw-tf-dev 0.92.2 requires scikit-learn==0.22.2, but you have scikit-learn 0.24.2 which is incompatible. Successfully installed `scikit-learn-0.24.2

I also tried using pip install --upgrade scikit-learn but did not have luck with that either.

(simbaenv) C:\Users\adae-lab-admin>pip install --upgrade scikit-learn Requirement already satisfied: scikit-learn in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (0.22.2) Collecting scikit-learn Using cached scikit_learn-0.24.2-cp36-cp36m-win_amd64.whl (6.8 MB) Requirement already satisfied: scipy>=0.19.1 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn) (1.1.0) Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn) (3.1.0) Requirement already satisfied: joblib>=0.11 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn) (1.1.0) Requirement already satisfied: numpy>=1.13.3 in c:\users\adae-lab-admin.conda\envs\simbaenv\lib\site-packages (from scikit-learn) (1.18.1) Installing collected packages: scikit-learn Attempting uninstall: scikit-learn Found existing installation: scikit-learn 0.22.2 Uninstalling scikit-learn-0.22.2: Successfully uninstalled scikit-learn-0.22.2 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. simba-uw-tf-dev 0.92.2 requires scikit-learn==0.22.2, but you have scikit-learn 0.24.2 which is incompatible. Successfully installed scikit-learn-0.24.2

I have very little coding experience, so I might be missing something obvious, but I can't seem to find any information online that could help me with this. Let me know if you have any questions!

sronilsson commented 2 years ago

Hi @autumnca!

You seem to be getting a dependency conflicts message during the installation, which is a feature of more recent versions of the python package installer pip. I wrote about some suggested solutions under point 11 HERE.

However it looks more like a warning rather than the installations actually erroring out. If you type simba in the terminal after seeing these msgs, does SimBA still launch?

PS. pip install scikit-learn --upgrade should upgrade the package rather than pip install --upgrade scikit-learn

autumnca commented 2 years ago

Hello,

I went through the suggestions under point 11, and now when I type simba in the terminal I'm met with a new error:

ModuleNotFoundError: No module named 'sklearn.metrics.classification'

And yesterday, when struggling with scikit-learn, I would still get an error for the conflicting versions and could not launch SimBA.

sronilsson commented 2 years ago

@autumnca - which version of pip and (if any) scikit-learn are you running? You should be able to find out by typing pip --version and pip show scikit-learn

autumnca commented 2 years ago

pip 21.2.2 and scikit-learn 0.22.2

sronilsson commented 2 years ago

Interesting that should work.. anyway. You can try the following:

Type pip uninstall simba-uw-tf-dev Type pip install pip==21.3.1 Type pip install simba-uw-tf-dev

And see if that fixes it?

autumnca commented 2 years ago

That worked! Thank you so so much I really appreciate your help.

sronilsson commented 2 years ago

Great! Thanks for letting me know