Skip to content

[MRG] Issue 7867: Install numpy and scipy using "install_requires" #10402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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