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

NOT ABLE TO RUN APP.PY #2

Open
JanviGalani opened this issue Feb 3, 2022 · 4 comments
Open

NOT ABLE TO RUN APP.PY #2

JanviGalani opened this issue Feb 3, 2022 · 4 comments

Comments

@JanviGalani
Copy link

model = pickle.load(open('model.pkl', 'rb'))
ModuleNotFoundError: No module named 'sklearn.svm.classes'

@HansaTharuka
Copy link

what is the python version you are using

@Shubhamkumar-op
Copy link

just import sklearn library or use anaconda environment so you don't get any error

@abhijeetGithu
Copy link

This error usually occurs when there is a mismatch between the versions of scikit-learn ( sklearn ) used during training and the version installed in your current environment.

Here are a few steps you can take to resolve this problem:
Check scikit-learn version : Ensure that you have scikit-learn installed and that it is up to date. You can use the following command to upgrade scikit-learn:

pip install --upgrade scikit-learn

Check pickle file compatibility: Verify that the 'model.pkl' file was created using a compatible version of scikit-learn. If the file was created with an older version, there might be compatibility issues. In this case, you may need to retrain the model using the current scikit-learn version and save it again.

Import the necessary modules explicitly: Instead of relying on the automatic import through the pickle file, you can explicitly import the required modules in your 'app.py' file. Add the following import statement before loading the pickled model:

from sklearn import svm
model = pickle.load(open('model.pkl', 'rb'), encoding='latin1')

@mahmoodshariff12
Copy link

mahmoodshariff12 commented Nov 7, 2024

i am unable to run.please help
model = pickle.load(open('model.pkl', 'rb'))
ModuleNotFoundError: No module named 'sklearn.svm.classes'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants