diff --git a/.appveyor.yml b/.appveyor.yml index afd1faa72756..05efdaf63275 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -19,9 +19,6 @@ environment: # theoretically the CONDA_INSTALL_LOCN could be only two: one for 32bit, # one for 64bit because we construct envs anyway. But using one for the # right python version is hopefully making it fast due to package caching. - - PYTHON_VERSION: "2.7" - CONDA_INSTALL_LOCN: "C:\\Miniconda-x64" - TEST_ALL: "no" - PYTHON_VERSION: "3.5" CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64" TEST_ALL: "no" diff --git a/.circleci/config.yml b/.circleci/config.yml index aeaecc820647..6fa03850027f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,9 +82,9 @@ doc-bundle-run: &doc-bundle # jobs: - docs-python35: + docs-python36: docker: - - image: circleci/python:3.5 + - image: circleci/python:3.6 steps: - checkout @@ -115,9 +115,9 @@ jobs: name: "Deploy new docs" command: ./.circleci/deploy-docs.sh - docs-python27: + docs-python35: docker: - - image: circleci/python:2.7 + - image: circleci/python:3.5 steps: - checkout @@ -128,10 +128,7 @@ jobs: - run: <<: *deps-install environment: - NUMPY_VERSION: "==1.7.1" - # Linkchecker only works with python 2.7 for the time being. - # Linkchecker is currently broken with requests 2.10.0 so force an earlier version. - - run: pip install --user $PRE requests==2.9.2 linkchecker + NUMPY_VERSION: "==1.10.0" - run: *mpl-install - run: *doc-build @@ -139,12 +136,6 @@ jobs: # We don't build the LaTeX docs here, so linkchecker will complain - run: touch doc/build/html/Matplotlib.pdf - # Linkchecker only works with python 2.7 for the time being - - run: - name: linkchecker - command: ~/.local/bin/linkchecker build/html/index.html - working_directory: doc - - run: *doc-bundle - store_artifacts: path: doc/build/sphinx-gallery-files.tar.gz @@ -166,4 +157,4 @@ workflows: build: jobs: - docs-python35 - - docs-python27 + - docs-python36 diff --git a/.travis.yml b/.travis.yml index 4973ace7027b..7aea3798a6bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,20 +65,20 @@ env: matrix: include: - - python: 2.7 + - python: 3.5 # pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124. env: - CYCLER=cycler==0.10 - DATEUTIL=python-dateutil==2.1 - MOCK=mock - NOSE=nose - - NUMPY=numpy==1.7.1 + - NUMPY=numpy==1.10.0 - PANDAS='pandas<0.21.0' - PYPARSING=pyparsing==2.0.1 - PYTEST=pytest==3.1.0 - PYTEST_COV=pytest-cov==2.3.1 - SPHINX=sphinx==1.3 - - python: 3.4 + - python: 3.5 env: PYTHON_ARGS=-OO - python: 3.6 env: DELETE_FONT_CACHE=1 PANDAS='pandas<0.21.0' PYTEST_PEP8=pytest-pep8 RUN_PEP8=--pep8 @@ -110,8 +110,12 @@ before_install: export PATH=/usr/lib/ccache:$PATH else brew update - brew tap homebrew/gui - brew install python libpng ffmpeg imagemagick mplayer ccache + brew install python3 libpng ffmpeg imagemagick mplayer ccache + # make 'python' mean 'python3' + ln -sf /usr/local/bin/python3 /usr/local/bin/python + hash -r + which python + python --version # We could install ghostscript and inkscape here to test svg and pdf # but this makes the test time really long. # brew install ghostscript inkscape @@ -126,10 +130,10 @@ install: ccache -s git describe # Upgrade pip and setuptools and wheel to get as clean an install as possible - pip install --upgrade pip setuptools wheel + python -mpip install --upgrade pip setuptools wheel - | # Install dependencies from PyPI - pip install --upgrade $PRE \ + python -mpip install --upgrade $PRE \ codecov \ coverage \ $CYCLER \ @@ -148,22 +152,22 @@ install: # install was successful by trying to import the toolkit (sometimes, the # install appears to be successful but shared libraries cannot be loaded at # runtime, so an actual import is a better check). - pip install cairocffi pgi && + python -mpip install cairocffi pgi && python -c 'import pgi as gi; gi.require_version("Gtk", "3.0"); from pgi.repository import Gtk' && echo 'pgi is available' || echo 'pgi is not available' - pip install pyqt5==5.9 && + python -mpip install pyqt5==5.9 && python -c 'import PyQt5.QtCore' && echo 'PyQt5 is available' || echo 'PyQt5 is not available' - pip install -U --pre \ + python -mpip install -U --pre \ --no-index -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 \ wxPython && python -c 'import wx' && echo 'wxPython is available' || echo 'wxPython is not available' - pip install $PRE \ + python -mpip install $PRE \ $PYTEST \ $PYTEST_COV \ pytest-faulthandler \ @@ -176,7 +180,7 @@ install: cp ci/travis/setup.cfg . - | # Install matplotlib - pip install -ve . + python -mpip install -ve . before_script: - | diff --git a/INSTALL.rst b/INSTALL.rst index 5e3d03a71509..fcc7ede51bbd 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -32,43 +32,14 @@ Although not required, we suggest also installing ``IPython`` for interactive use. To easily install a complete Scientific Python stack, see :ref:`install_scipy_dists` below. -.. _installing_windows: - -Windows -------- - -In case Python 2.7 or 3.4 are not installed for all users, -the Microsoft Visual C++ 2008 -(`64 bit `__ -or -`32 bit `__ -for Python 2.7) or Microsoft Visual C++ 2010 -(`64 bit `__ -or -`32 bit `__ -for Python 3.4) redistributable packages need to be installed. macOS ----- -If you are using Python 2.7 on a Mac you may need to do:: - - xcode-select --install - -so that *subprocess32*, a dependency, may be compiled. - To use the native OSX backend you will need :ref:`a framework build ` build of Python. -Linux ------ - -On extremely old versions of Linux and Python 2.7 you may need to -install the master version of *subprocess32* (`see comments -`__). - - Test Data --------- @@ -167,7 +138,7 @@ Dependencies Matplotlib requires a large number of dependencies: - * `Python `_ (>= 2.7 or >= 3.4) + * `Python `_ (>= 3.5) * `NumPy `_ (>= |minimum_numpy_version|) * `setuptools `__ * `dateutil `_ (>= 2.1) @@ -177,10 +148,6 @@ Matplotlib requires a large number of dependencies: * FreeType (>= 2.3) * `cycler `__ (>= 0.10.0) * `six `_ - * `backports.functools_lru_cache `_ - (for Python 2.7 only) - * `subprocess32 `_ (for Python - 2.7 only, on Linux and macOS only) * `kiwisolver `__ (>= 1.0.0) Optionally, you can also install a number of packages to enable better user @@ -325,8 +292,6 @@ without fiddling with environment variables:: conda install pyqt # this package is only available in the conda-forge channel conda install -c conda-forge msinttypes - # for Python 2.7 - conda install -c conda-forge backports.functools_lru_cache # copy the libs which have "wrong" names set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib diff --git a/ci/travis/test_script.sh b/ci/travis/test_script.sh index f0f9e1944433..f6446d21f16d 100755 --- a/ci/travis/test_script.sh +++ b/ci/travis/test_script.sh @@ -17,4 +17,4 @@ fi echo The following args are passed to pytest $PYTEST_ARGS $RUN_PEP8 -pytest $PYTEST_ARGS $RUN_PEP8 +python -mpytest $PYTEST_ARGS $RUN_PEP8 diff --git a/doc/faq/installing_faq.rst b/doc/faq/installing_faq.rst index 8dcb047da395..2e866804c991 100644 --- a/doc/faq/installing_faq.rst +++ b/doc/faq/installing_faq.rst @@ -216,11 +216,6 @@ the disk image installer only works for Python.org Python, and will not get picked up by other Pythons. If all these fail, please :ref:`let us know `. -Windows Notes -============= - -See :ref:`installing_windows`. - .. _install-from-git: Install from source diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 86776dd3069a..d90e9a0545e3 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -99,6 +99,8 @@ to MATLAB®, a registered trademark of The MathWorks, Inc. """ +# NOTE: This file must remain Python 2 compatible for the forseeable future, +# to ensure that we error out properly for existing editable installs. from __future__ import absolute_import, division, print_function import six @@ -122,6 +124,17 @@ import tempfile import warnings +if sys.version_info < (3, 5): # noqa: E402 + raise ImportError(""" +Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4. +Beginning with Matplotlib 3.0, Python 3.5 and above is required. + +See Matplotlib `INSTALL.rst` file for more information: + + https://github.com/matplotlib/matplotlib/blob/master/INSTALL.rst + +""") + # cbook must import matplotlib only within function # definitions, so it is safe to import from it here. from . import cbook @@ -142,7 +155,7 @@ _log = logging.getLogger(__name__) -__version__numpy__ = str('1.7.1') # minimum required numpy version +__version__numpy__ = str('1.10.0') # minimum required numpy version __bibtex__ = r"""@Article{Hunter:2007, Author = {Hunter, J. D.}, diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 09bae4ea5b37..f4ba5c06dcb3 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -283,7 +283,8 @@ def _dt64_to_ordinalf(d): # the "extra" ensures that we at least allow the dynamic range out to # seconds. That should get out to +/-2e11 years. - extra = d - d.astype('datetime64[s]') + # NOTE: First cast truncates; second cast back is for NumPy 1.10. + extra = d - d.astype('datetime64[s]').astype(d.dtype) extra = extra.astype('timedelta64[ns]') t0 = np.datetime64('0001-01-01T00:00:00').astype('datetime64[s]') dt = (d.astype('datetime64[s]') - t0).astype(np.float64) diff --git a/setup.py b/setup.py index e6e4b4dac2da..9a16373ee303 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,9 @@ setup.cfg.template for more information. """ +# NOTE: This file must remain Python 2 compatible for the forseeable future, +# to ensure that we error out properly for people with outdated setuptools +# and/or pip. from __future__ import print_function, absolute_import from string import Template from setuptools import setup @@ -265,6 +268,7 @@ def run(self): classifiers=classifiers, download_url="http://matplotlib.org/users/installing.html", + python_requires='>=3.5', # List third-party Python packages that we require install_requires=install_requires, setup_requires=setup_requires, diff --git a/setupext.py b/setupext.py index 99c30128e5f4..4e29476a1b0e 100644 --- a/setupext.py +++ b/setupext.py @@ -1,3 +1,6 @@ +# NOTE: This file must remain Python 2 compatible for the forseeable future, +# to ensure that we error out properly for people with outdated setuptools +# and/or pip. from __future__ import print_function, absolute_import from importlib import import_module @@ -680,15 +683,16 @@ class Python(SetupPackage): def check(self): major, minor1, minor2, s, tmp = sys.version_info - if major < 2: - raise CheckFailed( - "Requires Python 2.7 or later") - elif major == 2 and minor1 < 7: - raise CheckFailed( - "Requires Python 2.7 or later (in the 2.x series)") - elif major == 3 and minor1 < 4: - raise CheckFailed( - "Requires Python 3.4 or later (in the 3.x series)") + if major < 3 or minor1 < 5: + error = """ +Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4. +Beginning with Matplotlib 3.0, Python 3.5 and above is required. + +This may be due to an out of date pip. + +Make sure you have pip >= 9.0.1. +""" + raise CheckFailed(error) return sys.version