Skip to content

Compatibility with Python 3.7.0b5 #11224

@rth

Description

@rth

When running the tests suite on Python 3.7.0b5, with

Dockerfile
FROM python:3.7-rc

RUN apt-get update && apt-get install -y build-essential git make

RUN apt-get install -y libopenblas-dev

RUN python --version

RUN pip3 --version

RUN pip3 install Cython nose pytest numpy
RUN pip3 install scipy

RUN git clone --depth 1 https://github.com/scikit-learn/scikit-learn.git && \
    cd scikit-learn && git checkout master


RUN cd scikit-learn && pip3 install -e .

RUN cd scikit-learn && pytest sklearn

most tests appears to pass, but there are two minor doctest failures,

________________ [doctest] sklearn.exceptions.FitFailedWarning _________________
106     Examples
107     --------
108     >>> from sklearn.model_selection import GridSearchCV
109     >>> from sklearn.svm import LinearSVC
110     >>> from sklearn.exceptions import FitFailedWarning
111     >>> import warnings
112     >>> warnings.simplefilter('always', FitFailedWarning)
113     >>> gs = GridSearchCV(LinearSVC(), {'C': [-1, -2]}, error_score=0, cv=2)
114     >>> X, y = [[1, 2], [3, 4], [5, 6], [7, 8]], [0, 0, 1, 1]
115     >>> with warnings.catch_warnings(record=True) as w:
Expected:
    FitFailedWarning('Estimator fit failed. The score on this train-test
    partition for these parameters will be set to 0.000000.
    Details: \nValueError: Penalty term must be positive; got (C=-2)\n',)
Got:
    FitFailedWarning('Estimator fit failed. The score on this train-test partition for these parameters will be set to 0.000000. Details: \nValueError: Penalty term must be positive; got (C=-2)\n')

/scikit-learn/sklearn/exceptions.py:115: DocTestFailure
_________________ [doctest] sklearn.exceptions.NotFittedError __________________
019 Exception class to raise if estimator is used before fitting.
020 
021     This class inherits from both ValueError and AttributeError to help with
022     exception handling and backward compatibility.
023 
024     Examples
025     --------
026     >>> from sklearn.svm import LinearSVC
027     >>> from sklearn.exceptions import NotFittedError
028     >>> try:
Expected:
    NotFittedError('This LinearSVC instance is not fitted yet',)
Got:
    NotFittedError('This LinearSVC instance is not fitted yet')

Also there is a DeprecationWarning when running import sklearn reported in #11121

Metadata

Metadata

Assignees

No one assigned

    Labels

    EasyWell-defined and straightforward way to resolvegood first issueEasy with clear instructions to resolvehelp wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions