Skip to content

Commit a3910f2

Browse files
authored
Merge pull request wmayner#38 from TimothyFitz/copy-scipy-numpy-setup
Don't easy_install latest numpy if numpy is already available.
2 parents 61e746b + b0dde3b commit a3910f2

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

setup.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,24 @@ def finalize_options(self):
9292
exec(f.read(), ABOUT)
9393

9494

95-
REQUIRES = [
96-
'numpy >=1.9.0, <2.0.0'
97-
]
95+
NUMPY_REQUIREMENT = ['numpy >=1.9.0, <2.0.0']
96+
97+
# Copied from scipy's installer, to solve the same issues they saw:
98+
99+
# Figure out whether to add ``*_requires = ['numpy']``.
100+
# We don't want to do that unconditionally, because we risk updating
101+
# an installed numpy which fails too often. Just if it's not installed, we
102+
# may give it a try. See scipy gh-3379.
103+
try:
104+
import numpy
105+
except ImportError: # We do not have numpy installed
106+
REQUIRES = NUMPY_REQUIREMENT
107+
else:
108+
# If we're building a wheel, assume there already exist numpy wheels
109+
# for this platform, so it is safe to add numpy to build requirements.
110+
# See scipy gh-5184.
111+
REQUIRES = (NUMPY_REQUIREMENT if 'bdist_wheel' in sys.argv[1:]
112+
else [])
98113

99114
setup(
100115
name=ABOUT['__title__'],

0 commit comments

Comments
 (0)