Skip to content

Commit

Permalink
MAINT Use install_requires for numpy and scipy (scikit-learn#10402)
Browse files Browse the repository at this point in the history
  • Loading branch information
barrywhart authored and jnothman committed Jan 14, 2018
1 parent 74b69df commit 66bf809
Showing 1 changed file with 5 additions and 33 deletions.
38 changes: 5 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def configuration(parent_package='', top_path=None):
os.remove('MANIFEST')

from numpy.distutils.misc_util import Configuration

config = Configuration(None, parent_package, top_path)

# Avoid non-useful msg:
Expand All @@ -137,26 +138,6 @@ def configuration(parent_package='', top_path=None):
return config


def get_scipy_status():
"""
Returns a dictionary containing a boolean specifying whether SciPy
is up-to-date, along with the version string (empty string if
not installed).
"""
scipy_status = {}
try:
import scipy
scipy_version = scipy.__version__
scipy_status['up_to_date'] = parse_version(
scipy_version) >= parse_version(SCIPY_MIN_VERSION)
scipy_status['version'] = scipy_version
except ImportError:
traceback.print_exc()
scipy_status['up_to_date'] = False
scipy_status['version'] = ""
return scipy_status


def get_numpy_status():
"""
Returns a dictionary containing a boolean specifying whether NumPy
Expand Down Expand Up @@ -206,6 +187,10 @@ def setup_package():
'Programming Language :: Python :: 3.6',
],
cmdclass=cmdclass,
install_requires=[
'numpy>={0}'.format(NUMPY_MIN_VERSION),
'scipy>={0}'.format(SCIPY_MIN_VERSION)
],
**extra_setuptools_args)

if len(sys.argv) == 1 or (
Expand All @@ -229,9 +214,6 @@ def setup_package():
numpy_status = get_numpy_status()
numpy_req_str = "scikit-learn requires NumPy >= {0}.\n".format(
NUMPY_MIN_VERSION)
scipy_status = get_scipy_status()
scipy_req_str = "scikit-learn requires SciPy >= {0}.\n".format(
SCIPY_MIN_VERSION)

instructions = ("Installation instructions are available on the "
"scikit-learn website: "
Expand All @@ -247,16 +229,6 @@ def setup_package():
raise ImportError("Numerical Python (NumPy) is not "
"installed.\n{0}{1}"
.format(numpy_req_str, instructions))
if scipy_status['up_to_date'] is False:
if scipy_status['version']:
raise ImportError("Your installation of Scientific Python "
"(SciPy) {0} is out-of-date.\n{1}{2}"
.format(scipy_status['version'],
scipy_req_str, instructions))
else:
raise ImportError("Scientific Python (SciPy) is not "
"installed.\n{0}{1}"
.format(scipy_req_str, instructions))

from numpy.distutils.core import setup

Expand Down

0 comments on commit 66bf809

Please sign in to comment.