py
py copied to clipboard
ModuleNotFoundError: No module named 'sklearn.linear_model.base'
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
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.
@Sai-Rishith-Reddy-Gade
Do not use
from sklearn.externals import joblib
Instead use directly
import joblib
Source
geting same error how you solved this errpor of module not found please tell