Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'sklearn.ensemble.forest' #5

Closed
jainy opened this issue Mar 16, 2021 · 12 comments
Closed

ModuleNotFoundError: No module named 'sklearn.ensemble.forest' #5

jainy opened this issue Mar 16, 2021 · 12 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@jainy
Copy link

jainy commented Mar 16, 2021

Hi
Sorry, Its me again, Thank you for helping!
Now I have this error now. I installed the latest version of scikit-learn v0.41. But it says "ModuleNotFoundError: No module named 'sklearn.ensemble.forest'" Do you have any recommendation of a particular version for scikit-learn?
Traceback (most recent call last):
File "/home/jainy/software/xTea/xtea/x_TEA_main.py", line 1031, in
pkl_model = gc.load_model_from_file(sf_model)
File "/home/jainy/software/xTea/xtea/x_genotype_classify.py", line 182, in load_model_from_file
pickle_model = pickle.load(file, encoding='latin1')
ModuleNotFoundError: No module named 'sklearn.ensemble.forest'

Thanks again
Jainy

@simoncchu
Copy link
Collaborator

Hi Jainy,
In your terminal, if you directly run python, then from sklearn.ensemble import RandomForestClassifier does any error show up?

If you run conda install numpy scikit-learn pandas -y, does this solve your problem? Also, which version of python are you using?

@jainy
Copy link
Author

jainy commented Mar 17, 2021 via email

@simoncchu
Copy link
Collaborator

simoncchu commented Mar 18, 2021

It looks like an scikit-learn version issue (https://stackoverflow.com/questions/65758102/no-module-name-sklearn-forest-ensemble).
Would you please try with:
pip install -U scikit-learn==0.21.3

Sorry for the trouble caused. I need to set the specific versions of the packages.

@simoncchu simoncchu added bug Something isn't working enhancement New feature or request labels Mar 18, 2021
@jainy
Copy link
Author

jainy commented Mar 18, 2021 via email

@simoncchu
Copy link
Collaborator

Jainy, have you gotten the expected results with the warnings? Otherwise, need to use version 0.18.1 from which the model is trained.

I will update in the README and bioconda to the specific version.

@jainy
Copy link
Author

jainy commented Mar 19, 2021 via email

@simoncchu
Copy link
Collaborator

Thanks @jainy for the suggestion. I will train a new one with the latest version in the next release. Export a training mode is not difficult, just the training data is large. Let me think what's the best way.

@Pennybebraver
Copy link

Hi Simon,
I downloaded the latest version xTea 1.1 recently but got a similar error message as Jainy's as below:

Traceback (most recent call last):
File "/n/data1/bch/genetics/lee/penny/xTea_1_1/xtea/x_TEA_main.py", line 1031, in
pkl_model = gc.load_model_from_file(sf_model)
File "/n/data1/bch/genetics/lee/penny/xTea_1_1/xtea/x_genotype_classify.py", line 182, in load_model_from_file
pickle_model = pickle.load(file, encoding='latin1')
ModuleNotFoundError: No module named 'sklearn.ensemble.forest'
sort: cannot read: /n/data1/bch/genetics/lee/penny/xTea_1000_genome/working_dir/HG00740/SVA/candidate_disc_filtered_cns.txt.high_confident.post_filtering_with_gene_gntp.txt: No such file or directory
Running command: sort -k1,1V -k2,2n -o /n/data1/bch/genetics/lee/penny/xTea_1000_genome/working_dir/HG00740/SVA/candidate_disc_filtered_cns.txt.high_confident.post_filtering_with_gene_gntp.txt.sorted /n/data1/bch/genetics/lee/penny/xTea_1000_genome/working_dir/HG00740/SVA/candidate_disc_filtered_cns.txt.high_confident.post_filtering_with_gene_gntp.txt

Traceback (most recent call last):
File "/n/data1/bch/genetics/lee/penny/xTea_1_1/xtea/x_TEA_main.py", line 1065, in
gvcf.cvt_raw_rslt_to_gvcf(s_sample_id, sf_bam, sf_raw_rslt, i_rep_type, sf_ref, sf_vcf)
File "/n/data1/bch/genetics/lee/penny/xTea_1_1/xtea/x_gvcf.py", line 199, in cvt_raw_rslt_to_gvcf
with open(sf_raw_rslt_sorted) as fin_rslt:
FileNotFoundError: [Errno 2] No such file or directory: '/n/data1/bch/genetics/lee/penny/xTea_1000_genome/working_dir/HG00740/SVA/candidate_disc_filtered_cns.txt.high_confident.post_filtering_with_gene_gntp.txt.sorted'

I am not sure whether the following errors are causing by "ModuleNotFoundError: No module named 'sklearn.ensemble.forest'". Also, the scikit-learn version that I installed is 0.21.3 and I am using Python 3.7.4. Would you help take a look at that?

Thank you so much!

Best,
Penny

@gowthamkishorem
Copy link

Did Someone find how to resolve the issue ?
As the StackOverflow solution for this isn't working
please dm to gowthamkishore962@gmail.com if you know how to solve the problem

@PAVANPAGARWADEKAR
Copy link

simoncchu

Thank you very much. This worked very well.

@1126rejoice
Copy link

Please can anyone help me with the solution? ModuleNotFoundError
ModuleNotFoundError: No module named 'sklearn.ensemble.forest'

@gowthamkishorem
Copy link

gowthamkishorem commented May 16, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants