From f41f2e47c71c90a61e4b9364a54873276db685d3 Mon Sep 17 00:00:00 2001 From: Saket Choudhary Date: Mon, 9 Mar 2015 15:51:35 -0700 Subject: [PATCH] FIX: Ensure dependencies installed Fixes #1495 --- setup.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/setup.py b/setup.py index de129757ac62b..8b5066bdb359a 100755 --- a/setup.py +++ b/setup.py @@ -114,6 +114,19 @@ def configuration(parent_package='', top_path=None): return config +def is_scipy_installed(): + try: + import scipy + except ImportError: + return False + return True + +def is_numpy_installed(): + try: + import numpy + except ImportError: + return False + return True def setup_package(): metadata = dict(name=DISTNAME, @@ -162,6 +175,16 @@ def setup_package(): metadata['version'] = VERSION else: + if is_numpy_installed() is False: + raise ImportError("Numerical Python (NumPy) is not installed.\n" + "scikit-learn requires NumPy.\n" + "Installation instructions are available on scikit-learn website: " + "http://scikit-learn.org/stable/install.html\n") + if is_scipy_installed() is False: + raise ImportError("Scientific Python (SciPy) is not installed.\n" + "scikit-learn requires SciPy.\n" + "Installation instructions are available on scikit-learn website: " + "http://scikit-learn.org/stable/install.html\n") from numpy.distutils.core import setup metadata['configuration'] = configuration