ModuleNotFoundError: No module named 'sklearn.preprocessing._label'
See original GitHub issueon executing the following code
import os
import joblib
import pandas as pd
INPUT_PATH = os.environ.get('INPUT_PATH')
META_PATH = os.environ.get('META_PATH')
LOGS_PATH = os.environ.get('LOGS_PATH')
all_data_pipe = joblib.load(META_PATH + 'all_data_pipe.pkl')
I am getting the following error at last line joblib.load(META_PATH + 'all_data_pipe.pkl')
Traceback (most recent call last):
File "/home/winter_soilder/anaconda3/lib/python3.7/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/home/winter_soilder/anaconda3/lib/python3.7/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/home/winter_soilder/Desktop/MPG/Modelling/src/automl.py", line 16, in <module>
all_data_pipe = joblib.load(META_PATH + 'all_data_pipe.pkl')
File "/home/winter_soilder/my_envs/mpg/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 605, in load
obj = _unpickle(fobj, filename, mmap_mode)
File "/home/winter_soilder/my_envs/mpg/lib/python3.7/site-packages/joblib/numpy_pickle.py", line 529, in _unpickle
obj = unpickler.load()
File "/home/winter_soilder/anaconda3/lib/python3.7/pickle.py", line 1085, in load
dispatch[key[0]](self)
File "/home/winter_soilder/anaconda3/lib/python3.7/pickle.py", line 1373, in load_global
klass = self.find_class(module, name)
File "/home/winter_soilder/anaconda3/lib/python3.7/pickle.py", line 1423, in find_class
__import__(module, level=0)
ModuleNotFoundError: No module named 'sklearn.preprocessing._label'
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
No module named 'sklearn.preprocessing._data' - Stack ...
I think the issue was caused by running the pickle dump for creating the scaler file on a machine with a newer version...
Read more >ModuleNotFoundError: No module named 'sklearn' in Python
The Python "ModuleNotFoundError: No module named 'sklearn'" occurs when we forget to install the scikit-learn module before importing it or ...
Read more >Fix ModuleNotFoundError: No module named 'sklearn'
This error indicates that the scikit-learn (aka sklearn ) package was not installed, or even if it was installed for some reason it...
Read more >[Fixed] ModuleNotFoundError: No module named 'scikit-learn'
Quick Fix: Python raises the ImportError: No module named 'scikit-learn' when it cannot find the library scikit-learn . The most frequent source of...
Read more >xgboost - No module named 'sklearn.preprocessing._label'
I was able to solve my issue. Simply update scikit-learn from 0.21.3 to 0.22.0 seems to solve the issue. Along the way I...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rth I have
scikit-learn 0.24.1
, but I still have the same problemLooks like you created this pickle with scikit-learn >=0.22.0 and are trying to load it with scikit-learn <0.22.0.
Pickles are not necessarily compatible across scikit-learn versions so this behavior is expected (and the use case is not supported). For more details, see https://scikit-learn.org/dev/modules/model_persistence.html#model-persistence