ventolab / CellphoneDB

CellPhoneDB can be used to search for a particular ligand/receptor, or interrogate your own HUMAN single-cell transcriptomics data.
https://www.cellphonedb.org/
MIT License
322 stars 51 forks source link

ModuleNotFoundError: No module named 'sklearn.cluster.k_means_' #25

Closed TsviyaOlender closed 1 year ago

TsviyaOlender commented 2 years ago

Hi This is the first time I am using cellphoneDB. I installed in under python/3.7.9. I used the command: pip install --user cellphonedb

Otherwise, I am getting an error: ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: 'libgomp-f7e03b3e.so.1.0.0' Consider using the --user option or check the permissions.

After the installation, I tested the most basic command, and got an error: ModuleNotFoundError: No module named 'sklearn.cluster.kmeans' Please see the below.

Please advise me. Tsviya

(cpdb) [lvzvia@molgen2 ~]$ cellphonedb method degs_analysis test_meta.txt test_counts.txt test_DEGs.txt Traceback (most recent call last): File "/home/labs/olenderlab/lvzvia/.local/bin/cellphonedb", line 5, in from cellphonedb.cellphonedb_cli import cli File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/cellphonedb_cli.py", line 6, in from cellphonedb.src.api_endpoints.terminal_api.database_terminal_api_endpoints import database_terminal_commands File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/src/api_endpoints/terminal_api/database_terminal_api_endpoints/database_terminal_commands.py", line 8, in from cellphonedb.src.api_endpoints.terminal_api.tools_terminal_api_endpoints.tools_terminal_commands import \ File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/src/api_endpoints/terminal_api/tools_terminal_api_endpoints/tools_terminal_commands.py", line 10, in from cellphonedb.src.app.cellphonedb_app import output_dir, data_dir File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/src/app/cellphonedb_app.py", line 3, in from cellphonedb.src.app.flask.flask_cellphonedb import CellphonedbFlask File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/src/app/flask/flask_cellphonedb.py", line 1, in from cellphonedb.src.core.CellphonedbSqlalchemy import CellphonedbSqlalchemy File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/src/core/CellphonedbSqlalchemy.py", line 5, in from cellphonedb.src.core.Cellphonedb import Cellphonedb File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/src/core/Cellphonedb.py", line 5, in from cellphonedb.src.core.methods.method_launcher import MethodLauncher File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/src/core/methods/method_launcher.py", line 10, in from cellphonedb.src.core.utils.subsampler import Subsampler File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/cellphonedb/src/core/utils/subsampler.py", line 6, in from geosketch import gs File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/geosketch/init.py", line 1, in from .sketch import File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/geosketch/sketch.py", line 7, in from .kmeanspp import kmeanspp File "/home/labs/olenderlab/lvzvia/.local/lib/python3.7/site-packages/geosketch/kmeanspp.py", line 1, in from sklearn.cluster.kmeans import ModuleNotFoundError: No module named 'sklearn.cluster.kmeans'

prete commented 2 years ago

Hi @TsviyaOlender , thank you for using CellPhoneDB. The error probably comes from you having a differnet version of scikit-learn than the one needed for geosketch. Could you please check the versions of scikit-learn and geosketch you've got installed in your environment? (pip show scikit-learn geosketch)

jkhlai commented 1 year ago

hello, I am also facing the same issue my sklearn and geosketch versions as below

Name: scikit-learn
Version: 1.0.1
Summary: A set of python modules for machine learning and data mining
Home-page: http://scikit-learn.org
Author:
Author-email:
License: new BSD
Location: /home/jlai/.local/lib/python3.8/site-packages
Requires: joblib, numpy, scipy, threadpoolctl
Required-by: CellPhoneDB, geosketch, SigProfilerExtractor, sklearn
---
Name: geosketch
Version: 0.3
Summary: Geometry-preserving random sampling
Home-page: https://github.com/brianhie/geosketch
Author: Brian Hie
Author-email: brianhie@mit.edu
License: MIT
Location: /usr/local/lib/python3.8/site-packages
Requires: fbpca, numpy, scikit-learn
Required-by: CellPhoneDB
prete commented 1 year ago

Hi @jkhlai, thank you for using CellPhoneDB. You'll need to downgrade scikit-learn to version 0.22 which is the current required for CellPhoneDB. Running pip install -U scikit-learn==0.22 should get you the right version.

jkhlai commented 1 year ago

Thanks @prete, I was running cellphonedb from a singularity image and the python path defaulted to my local home directory where sklearn is not version 0.22. Adding PYTHONPATH="/usr/local/lib/python3.8/site-packages" solved the problem

wangjiawen2013 commented 1 year ago

The latest scikit-learn is 1.2.2, hope cellphonedb use the latest version for compatibility with other python packages !