Skip to content

Commit 081bd4d

Browse files
committed
FIX: Ensure dependencies installed
1 parent 2b28b27 commit 081bd4d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

setup.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ def configuration(parent_package='', top_path=None):
114114

115115
return config
116116

117+
def is_scipy_installed():
118+
try:
119+
import scipy
120+
except ImportError:
121+
return False
122+
return True
123+
124+
def is_numpy_installed():
125+
try:
126+
import numpy
127+
except ImportError:
128+
return False
129+
return True
117130

118131
def setup_package():
119132
metadata = dict(name=DISTNAME,
@@ -162,6 +175,18 @@ def setup_package():
162175

163176
metadata['version'] = VERSION
164177
else:
178+
if is_numpy_installed() is False:
179+
sys.stderr.write("Error: Numerical Python(NumPy) is not installed.\n"
180+
"scikit-learn requires NumPy.\n"
181+
"Instruction installations are available on scikit-learn website:\
182+
http://scikit-learn.org/stable/install.html\n")
183+
sys.exit(1)
184+
if is_scipy_installed() is False:
185+
sys.stderr.write("Error: Scientific Python(SciPy) is not installed.\n"
186+
"scikit-learn requires SciPy.\n"
187+
"Instruction installations are available on scikit-learn website:\
188+
http://scikit-learn.org/stable/install.html\n")
189+
sys.exit(1)
165190
from numpy.distutils.core import setup
166191

167192
metadata['configuration'] = configuration

0 commit comments

Comments
 (0)