8000 Merge pull request #4371 from saketkc/fix_setup · scikit-learn/scikit-learn@95f9be5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 95f9be5

Browse files
committed
Merge pull request #4371 from saketkc/fix_setup
[MRG + 2] Ensure dependencies installed
2 parents f6b52d2 + f41f2e4 commit 95f9be5

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

setup.py

Lines changed: 23 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,16 @@ def setup_package():
162175

163176
metadata['version'] = VERSION
164177
else:
178+
if is_numpy_installed() is False:
179+
raise ImportError("Numerical Python (NumPy) is not installed.\n"
180+
"scikit-learn requires NumPy.\n"
181+
"Installation instructions are available on scikit-learn website: "
182+
"http://scikit-learn.org/stable/install.html\n")
183+
if is_scipy_installed() is False:
184+
raise ImportError("Scientific Python (SciPy) is not installed.\n"
185+
"scikit-learn requires SciPy.\n"
186+
"Installation instructions are available on scikit-learn website: "
187+
"http://scikit-learn.org/stable/install.html\n")
165188
from numpy.distutils.core import setup
166189

167190
metadata['configuration'] = configuration

0 commit comments

Comments
 (0)
0