Closed kibambe-0167 closed 1 year ago
commenting out "_MissingValues" from the imports of "/env-si/lib/python3.10/site-packages/sklearn/utils/_param_validation.py" from future versions will very much help.
Duplicate of #995?
yeah, i tried fixing it on this PR #997
ImportError: cannot import name '_MissingValues' from 'sklearn.utils._param_validation' (/env/lib/python3.10/site-packages/sklearn/utils/_param_validation.py)
Steps/Code to Reproduce
import matplotlib.pyplot as plt import sklearn from imblearn.combine import SMOTETomek
Expected Results
successfully run this line -> from imblearn.combine import SMOTETomek
Actual Results
ImportError Traceback (most recent call last) Cell In[5], line 6 4 import matplotlib.pyplot as plt 5 import sklearn ----> 6 from imblearn.combine import SMOTETomek
File /env-si/lib/python3.10/site-packages/imblearn/init.py:52 48 sys.stderr.write("Partial import of imblearn during the build process.\n") 49 # We are not importing the rest of scikit-learn during the build 50 # process, as it may not be compiled yet 51 else: ---> 52 from . import ( 53 combine, 54 ensemble, 55 exceptions, 56 metrics, 57 over_sampling, 58 pipeline, 59 tensorflow, 60 under_sampling, 61 utils, 62 ) 63 from ._version import version 64 from .base import FunctionSampler
File /env-si/lib/python3.10/site-packages/imblearn/combine/init.py:5 1 """The :mod:
imblearn.combine
provides methods which combine 2 over-sampling and under-sampling. 3 """ ----> 5 from ._smote_enn import SMOTEENN 6 from ._smote_tomek import SMOTETomek 8 all = ["SMOTEENN", "SMOTETomek"]File /env-si/lib/python3.10/site-packages/imblearn/combine/_smote_enn.py:12 9 from sklearn.base import clone 10 from sklearn.utils import check_X_y ---> 12 from ..base import BaseSampler 13 from ..over_sampling import SMOTE 14 from ..over_sampling.base import BaseOverSampler
File /env-si/lib/python3.10/site-packages/imblearn/base.py:21 18 from sklearn.utils.multiclass import check_classification_targets 20 from .utils import check_sampling_strategy, check_target_type ---> 21 from .utils._param_validation import validate_parameter_constraints 22 from .utils._validation import ArraysTransformer 25 class SamplerMixin(BaseEstimator, metaclass=ABCMeta):
File /env-si/lib/python3.10/site-packages/imblearn/utils/_param_validation.py:908 906 from sklearn.utils._param_validation import generate_valid_param # noqa 907 from sklearn.utils._param_validation import validate_parameter_constraints # noqa --> 908 from sklearn.utils._param_validation import ( 909 HasMethods, 910 Hidden, 911 Interval, 912 Options, 913 StrOptions, 914 _ArrayLikes, 915 _Booleans, 916 _Callables, 917 _CVObjects, 918 _InstancesOf, 919 _IterablesNotString, 920 _MissingValues, 921 _NoneConstraint, 922 _PandasNAConstraint, 923 _RandomStates, 924 _SparseMatrices, 925 _VerboseHelper, 926 make_constraint, 927 validate_params, 928 )
ImportError: cannot import name '_MissingValues' from 'sklearn.utils._param_validation' (/env-si/lib/python3.10/site-packages/sklearn/utils/_param_validation.py)
Versions
System: python: 3.10.7 (v3.10.7:6cc6b13308, Sep 5 2022, 14:02:52) [Clang 13.0.0 (clang-1300.0.29.30)] executable: /env-si/bin/python machine: macOS-13.4.1-arm64-arm-64bit
Python dependencies: sklearn: 1.3.0 pip: 23.1.2 setuptools: 67.8.0 numpy: 1.25.0 scipy: 1.11.1 Cython: None pandas: 2.0.3 matplotlib: 3.7.1 joblib: 1.3.1 threadpoolctl: 3.1.0
Built with OpenMP: True
threadpoolctl info: user_api: blas internalapi: openblas prefix: libopenblas filepath: [/env-si/lib/python3.10/site-packages/numpy/.dylibs/libopenblas64.0.dylib](https://file+.vscode-resource.vscode-cdn.net/Users/aapoh/codes/ghp/statistical-inference/env-si/lib/python3.10/site-packages/numpy/.dylibs/libopenblas64_.0.dylib) version: 0.3.23 threading_layer: pthreads architecture: armv8 num_threads: 8
internal_api: openblas prefix: libopenblas filepath: /env-si/lib/python3.10/site-packages/scipy/.dylibs/libopenblas.0.dylib version: 0.3.21.dev threading_layer: pthreads architecture: armv8 num_threads: 8
internal_api: openmp prefix: libomp filepath: /env-si/lib/python3.10/site-packages/sklearn/.dylibs/libomp.dylib version: None num_threads: 8