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.linear_model.base' #216

Open
Sai-Rishith-Reddy-Gade opened this issue Oct 3, 2023 · 2 comments

Comments

@Sai-Rishith-Reddy-Gade
Copy link

I encountered a ModuleNotFoundError while running the server. The error occurs when the script attempts to load the model using pickle. It specifically states that there is no module named 'sklearn.linear_model.base'.

Error Details :

loading saved artifacts...start
Traceback (most recent call last):
File "C:\Code\BHP\server\util.py", line 47, in
load_saved_artifacts()
File "C:\Code\BHP\server\util.py", line 37, in load_saved_artifacts
__model = pickle.load(f)
ModuleNotFoundError: No module named 'sklearn.linear_model.base'

Context:

This error is occurring in the load_saved_artifacts() function within util.py. The issue seems to be related to the loading of the machine learning model using pickle. It suggests that the necessary module or package (sklearn.linear_model.base) is not found during the loading process.

Potential Solutions Attempted:

Module Installation: I have attempted to install the required module using pip, but the issue persists.

Alternative Approach: I have also tried using joblib as an alternative to pickle for model persistence, but the error still occurs.

Additional Notes:

The server and utility files seem correct, but there might be an underlying issue with the environment or dependencies.

It's possible there could be a conflict between different versions of libraries or an issue with the Python environment configuration.

Any assistance in resolving this issue would be greatly appreciated.

@shivam-maurya-git
Copy link

shivam-maurya-git commented Dec 3, 2023

@Sai-Rishith-Reddy-Gade
Do not use
from sklearn.externals import joblib
Instead use directly
import joblib
Source

@dhananjaybhugaonkar
Copy link

geting same error how you solved this errpor of module not found please tell

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

3 participants