diff --git a/INSTALL.rst b/INSTALL.rst index dfb81ad1c7340abf9617f46a09f06e826ccdef61..b00fbdf9d61d2f9f9251c85228a4cd7e28605614 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -29,7 +29,7 @@ Prerequisites ============= Building Kwant requires - * `Python <https://www.python.org/>`_ 3.4 or above (Kwant 1.1 is the last + * `Python <https://www.python.org/>`_ 3.5 or above (Kwant 1.1 is the last version to support Python 2), * `NumPy <http://numpy.org/>`_ 1.11.0 or newer, * `SciPy <https://scipy.org/>`_ 0.17.0 or newer, diff --git a/setup.py b/setup.py index 74f45b0b007ea9af584fc05e4512c58421950e4e..160a6030f523beb6f3a566d284ef4fc97c76242d 100755 --- a/setup.py +++ b/setup.py @@ -124,6 +124,16 @@ def configure_extensions(exts, aliases=(), build_summary=None): return exts +def check_python_version(min_version): + installed_version = sys.version_info[:3] + if installed_version < min_version: + print('Error: Python {} required, but {} is installed'.format( + '.'.join(map(str, min_version)), + '.'.join(map(str, installed_version))) + ) + sys.exit(1) + + def check_versions(): global version, version_is_from_git @@ -557,6 +567,7 @@ def maybe_cythonize(exts): def main(): + check_python_version((3, 5)) check_versions() exts = collections.OrderedDict([