bcgsc / NanoSim

Nanopore sequence read simulator
Other
233 stars 56 forks source link

Issue with sklearn.neighbors.kde #131

Closed Michal-Babins closed 2 years ago

Michal-Babins commented 3 years ago

Issue: When running simulator.py, I run into the error of sklearn.neighbors.kde not being recognized as a module. My version of scikit-learn==0.24.0. When I try to install older version it tells me they are incompatible with my system.

Command: python /home/mbabinski/SYNTH/NanoSim/src/simulator.py metagenome --genome_list /home/mbabinski/SYNTH/test_semsiq/nanosim_data/metagenome_list_simulation.tsv --abun /home/mbabinski/SYNTH/test_semsiq/nanosim_data/abundance_for_sim.tsv --dna_type_list /home/mbabinski/SYNTH/test_semsiq/nanosim_data/dna_type_list.tsv -c /home/mbabinski/SYNTH/NanoSim/pre-trained_models/metagenome_ERR3152364_Even/training --output /home/mbabinski/SYNTH/call_tools/test_out/testsim --num_threads 2

Error: Traceback (most recent call last): File "/home/mbabinski/SYNTH/NanoSim/src/simulator.py", line 2318, in main() File "/home/mbabinski/SYNTH/NanoSim/src/simulator.py", line 2277, in main read_profile(genome_list, [], model_prefix, perfect, args.mode, strandness, dna_type=dna_type_list, abun=abun, File "/home/mbabinski/SYNTH/NanoSim/src/simulator.py", line 509, in read_profile kde_unaligned = joblib.load(model_prefix + "_unaligned_length.pkl") File "/home/mbabinski/miniconda3/envs/all_tools/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 585, in load obj = _unpickle(fobj, filename, mmap_mode) File "/home/mbabinski/miniconda3/envs/all_tools/lib/python3.9/site-packages/joblib/numpy_pickle.py", line 504, in _unpickle obj = unpickler.load() File "/home/mbabinski/miniconda3/envs/all_tools/lib/python3.9/pickle.py", line 1212, in load dispatchkey[0] File "/home/mbabinski/miniconda3/envs/all_tools/lib/python3.9/pickle.py", line 1528, in load_global klass = self.find_class(module, name) File "/home/mbabinski/miniconda3/envs/all_tools/lib/python3.9/pickle.py", line 1579, in find_class import(module, level=0) ModuleNotFoundError: No module named 'sklearn.neighbors.kde'

Suggestion: Add version labels to the reqiurements.txt file

Thanks!

cheny19 commented 3 years ago

Thanks for reporting this. This issue has been raised by #120 , could you try downgrading scikit-learn to 0.21 to see if it works?

Thanks, Chen

Michal-Babins commented 3 years ago

Hey Chen

It does not work with 0.21, but in it's own isolated environment I can get 0.22 installed. It appears older versions of scikit are incompatible with glibc==2.27.

briannadon commented 2 years ago

I want to confirm this is still an issue. Having the same problem with sklearn.neighbors.kde

kmnip commented 2 years ago

Hi @briannadon , I am using scikit-learn version 1.0.2 and I don't have any issues with simulator.py. Can you please try upgrading your package version? Please let us know if that works for you!

nealplatt commented 2 years ago

I want to confirm this is still an issue. Having the same problem with sklearn.neighbors.kde

This is still a problem for me. I installed from conda. Which doesn't seem to include the scikit-lean req. I installed it separately and have this problem. Part of the reason though is I am stuck in a dependency hell.

kmnip commented 2 years ago

I want to confirm this is still an issue. Having the same problem with sklearn.neighbors.kde

This is still a problem for me. I installed from conda. Which doesn't seem to include the scikit-lean req. I installed it separately and have this problem. Part of the reason though is I am stuck in a dependency hell.

The requirements.txt from the master branch and the Bioconda recipe do have scikit-learn as one of NanoSim's required packages.

For dependency hell, installing the problematic package(s) first within a brand new environment may help.

conda create -n nanosim
conda activate nanosim
conda install scikit-learn
conda install -c bioconda nanosim
SaberHQ commented 2 years ago

Please note that pull request #158 solves this issue by updating the scikit-learn version in requirements.txt

Previous sklearn.neighbors.kde has been renamed to sklearn.neighbors._kde in version 0.22.1. You have probably a version of scikit-learn older than that. Installing the latest release solves the problem:

pip install scikit-learn==0.22.1

For more information and help, please check this stackoverflow question/answer

I am closing this issue. If anyone finds a similar issue, please feel free to reopen it and we will be more than happy to help you. Thanks.