py icon indicating copy to clipboard operation
py copied to clipboard

ModuleNotFoundError: No module named 'sklearn.linear_model.base'

Open Sai-Rishith-Reddy-Gade opened this issue 2 years ago • 2 comments

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.

Sai-Rishith-Reddy-Gade avatar Oct 03 '23 21:10 Sai-Rishith-Reddy-Gade

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

shivam-maurya-git avatar Dec 03 '23 06:12 shivam-maurya-git

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

dhananjaybhugaonkar avatar Apr 28 '24 03:04 dhananjaybhugaonkar