Skip to content

Commit

Permalink
[MRG+1] Dropping python 2.6 support (scikit-learn#7890)
Browse files Browse the repository at this point in the history
* Remove Python 2.6 support

Some details about some slightly orthogonal changes:
* Note about cheking safely for nan is likely not valid any more (commit
  introducing it is c80ca91)
* scipy.linalg.qr econ parameter removed since scipy 0.9 in favour of
  mode='economic'
* Remove unnecessary libgfortran in conda create command

* Putative fix by setting the random seed

* Revert unintended change

* Reinstate previous logic for checking for NaNs

* Reinstate change in error message

Error messages from Python 2.7 assertRegexp does not contain the
function name, in contrast with Python 3 assertRegex
  • Loading branch information
lesteve authored and amueller committed Nov 23, 2016
1 parent c171561 commit e5bf61e
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 463 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
- DISTRIB="ubuntu" PYTHON_VERSION="2.7" CYTHON_VERSION="0.23.4"
COVERAGE=true
# This environment tests the oldest supported anaconda env
- DISTRIB="conda" PYTHON_VERSION="2.6" INSTALL_MKL="false"
- DISTRIB="conda" PYTHON_VERSION="2.7" INSTALL_MKL="false"
NUMPY_VERSION="1.6.2" SCIPY_VERSION="0.11.0" CYTHON_VERSION="0.23"
# This environment tests the newest supported anaconda env
# It also runs tests requiring Pandas.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Dependencies

scikit-learn requires:

- Python (>= 2.6 or >= 3.3)
- Python (>= 2.7 or >= 3.3)
- NumPy (>= 1.6.1)
- SciPy (>= 0.9)

Expand Down
10 changes: 2 additions & 8 deletions build_tools/travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,17 @@ if [[ "$DISTRIB" == "conda" ]]; then
if [[ "$INSTALL_MKL" == "true" ]]; then
conda create -n testenv --yes python=$PYTHON_VERSION pip nose \
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION numpy scipy \
libgfortran mkl flake8 \
mkl flake8 cython=$CYTHON_VERSION \
${PANDAS_VERSION+pandas=$PANDAS_VERSION}

else
conda create -n testenv --yes python=$PYTHON_VERSION pip nose \
numpy=$NUMPY_VERSION scipy=$SCIPY_VERSION \
libgfortran nomkl \
nomkl cython=$CYTHON_VERSION \
${PANDAS_VERSION+pandas=$PANDAS_VERSION}
fi
source activate testenv

# Temporary work around for Python 2.6 because cython >= 0.23 is
# required for building scikit-learn but python 2.6 and cython
# 0.23 are not compatible in conda. Remove the next line and
# install cython via conda when Python 2.6 support is removed.
pip install cython==$CYTHON_VERSION

# Install nose-timer via pip
pip install nose-timer

Expand Down
2 changes: 1 addition & 1 deletion doc/developers/advanced_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Installing an official release

Scikit-learn requires:

- Python (>= 2.6 or >= 3.3),
- Python (>= 2.7 or >= 3.3),
- NumPy (>= 1.6.1),
- SciPy (>= 0.9).

Expand Down
2 changes: 1 addition & 1 deletion doc/developers/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ Python 3.x support
All scikit-learn code should work unchanged in both Python 2.[67]
and 3.2 or newer. Since Python 3.x is not backwards compatible,
that may require changes to code and it certainly requires testing
on both 2.6 or 2.7, and 3.2 or newer.
on both 2.7 and 3.2 or newer.

For most numerical algorithms, Python 3.x support is easy:
just remember that ``print`` is a function and
Expand Down
2 changes: 1 addition & 1 deletion doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Installing the latest release

Scikit-learn requires:

- Python (>= 2.6 or >= 3.3),
- Python (>= 2.7 or >= 3.3),
- NumPy (>= 1.6.1),
- SciPy (>= 0.9).

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ def setup_package():
'Operating System :: Unix',
'Operating System :: MacOS',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
Expand Down
2 changes: 1 addition & 1 deletion sklearn/ensemble/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from sklearn.ensemble import BaggingClassifier
from sklearn.ensemble.base import _set_random_states
from sklearn.linear_model import Perceptron
from sklearn.externals.odict import OrderedDict
from collections import OrderedDict
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.pipeline import Pipeline
from sklearn.feature_selection import SelectFromModel
Expand Down
7 changes: 2 additions & 5 deletions sklearn/externals/funcsigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
"""Function signature objects for callables
Back port of Python 3.3's function signature tools from the inspect module,
modified to be compatible with Python 2.6, 2.7 and 3.2+.
modified to be compatible with Python 2.7 and 3.2+.
"""
from __future__ import absolute_import, division, print_function
import itertools
import functools
import re
import types

try:
from collections import OrderedDict
except ImportError:
from .odict import OrderedDict
from collections import OrderedDict

__version__ = "0.4"

Expand Down
266 changes: 0 additions & 266 deletions sklearn/externals/odict.py

This file was deleted.

9 changes: 1 addition & 8 deletions sklearn/gaussian_process/gaussian_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,7 @@ def reduced_likelihood_function(self, theta=None):

# Get generalized least squares solution
Ft = linalg.solve_triangular(C, F, lower=True)
try:
Q, G = linalg.qr(Ft, econ=True)
except:
#/usr/lib/python2.6/dist-packages/scipy/linalg/decomp.py:1177:
# DeprecationWarning: qr econ argument will be removed after scipy
# 0.7. The economy transform will then be available through the
# mode='economic' argument.
Q, G = linalg.qr(Ft, mode='economic')
Q, G = linalg.qr(Ft, mode='economic')

sv = linalg.svd(G, compute_uv=False)
rcondG = sv[-1] / sv[0]
Expand Down
Loading

0 comments on commit e5bf61e

Please sign in to comment.