1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
|
From eed8f56c787a251a6cad0f4291ca8f4055e463cf Mon Sep 17 00:00:00 2001
From: Jack Mitchell <ml@embed.me.uk>
Date: Fri, 22 Jan 2021 10:16:08 +0000
Subject: [PATCH] hack around numpy get_include to force looking in target
sysroot
---
sklearn/__check_build/setup.py | 4 ++--
sklearn/cluster/setup.py | 12 ++++++------
sklearn/datasets/setup.py | 4 ++--
sklearn/decomposition/setup.py | 6 +++---
sklearn/ensemble/setup.py | 22 +++++++++++-----------
sklearn/feature_extraction/setup.py | 4 ++--
sklearn/linear_model/setup.py | 8 ++++----
sklearn/manifold/setup.py | 6 +++---
sklearn/metrics/cluster/setup.py | 4 ++--
sklearn/neighbors/setup.py | 15 +++++++--------
sklearn/preprocessing/setup.py | 4 ++--
sklearn/setup.py | 4 ++--
sklearn/svm/setup.py | 11 ++++++-----
sklearn/tree/setup.py | 10 +++++-----
sklearn/utils/setup.py | 16 ++++++++--------
15 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/sklearn/__check_build/setup.py b/sklearn/__check_build/setup.py
index b8c30d9c8..e2bfc90ee 100644
--- a/sklearn/__check_build/setup.py
+++ b/sklearn/__check_build/setup.py
@@ -1,7 +1,7 @@
# Author: Virgile Fritsch <virgile.fritsch@inria.fr>
# License: BSD 3 clause
-import numpy
+import numpy, os
def configuration(parent_package='', top_path=None):
@@ -9,7 +9,7 @@ def configuration(parent_package='', top_path=None):
config = Configuration('__check_build', parent_package, top_path)
config.add_extension('_check_build',
sources=['_check_build.pyx'],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
return config
diff --git a/sklearn/cluster/setup.py b/sklearn/cluster/setup.py
index 48ed25c5c..bd395e3aa 100644
--- a/sklearn/cluster/setup.py
+++ b/sklearn/cluster/setup.py
@@ -2,7 +2,7 @@
# License: BSD 3 clause
import os
-import numpy
+import numpy, os
def configuration(parent_package='', top_path=None):
@@ -16,28 +16,28 @@ def configuration(parent_package='', top_path=None):
config.add_extension('_dbscan_inner',
sources=['_dbscan_inner.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
language="c++")
config.add_extension('_hierarchical_fast',
sources=['_hierarchical_fast.pyx'],
language="c++",
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension('_k_means_fast',
sources=['_k_means_fast.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension('_k_means_lloyd',
sources=['_k_means_lloyd.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension('_k_means_elkan',
sources=['_k_means_elkan.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_subpackage('tests')
diff --git a/sklearn/datasets/setup.py b/sklearn/datasets/setup.py
index 1107505d4..de4ac3c87 100644
--- a/sklearn/datasets/setup.py
+++ b/sklearn/datasets/setup.py
@@ -1,5 +1,5 @@
-import numpy
+import numpy, os
import os
import platform
@@ -14,7 +14,7 @@ def configuration(parent_package='', top_path=None):
if platform.python_implementation() != 'PyPy':
config.add_extension('_svmlight_format_fast',
sources=['_svmlight_format_fast.pyx'],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_subpackage('tests')
return config
diff --git a/sklearn/decomposition/setup.py b/sklearn/decomposition/setup.py
index f915d6d78..26799c0af 100644
--- a/sklearn/decomposition/setup.py
+++ b/sklearn/decomposition/setup.py
@@ -1,5 +1,5 @@
import os
-import numpy
+import numpy, os
from numpy.distutils.misc_util import Configuration
@@ -12,12 +12,12 @@ def configuration(parent_package="", top_path=None):
config.add_extension("_online_lda_fast",
sources=["_online_lda_fast.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension('_cdnmf_fast',
sources=['_cdnmf_fast.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_subpackage("tests")
diff --git a/sklearn/ensemble/setup.py b/sklearn/ensemble/setup.py
index 05d71cf31..c12382220 100644
--- a/sklearn/ensemble/setup.py
+++ b/sklearn/ensemble/setup.py
@@ -1,4 +1,4 @@
-import numpy
+import numpy, os
from numpy.distutils.misc_util import Configuration
@@ -7,7 +7,7 @@ def configuration(parent_package="", top_path=None):
config.add_extension("_gradient_boosting",
sources=["_gradient_boosting.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_subpackage("tests")
@@ -15,39 +15,39 @@ def configuration(parent_package="", top_path=None):
config.add_extension(
"_hist_gradient_boosting._gradient_boosting",
sources=["_hist_gradient_boosting/_gradient_boosting.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension("_hist_gradient_boosting.histogram",
sources=["_hist_gradient_boosting/histogram.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension("_hist_gradient_boosting.splitting",
sources=["_hist_gradient_boosting/splitting.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension("_hist_gradient_boosting._binning",
sources=["_hist_gradient_boosting/_binning.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension("_hist_gradient_boosting._predictor",
sources=["_hist_gradient_boosting/_predictor.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension("_hist_gradient_boosting._loss",
sources=["_hist_gradient_boosting/_loss.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension("_hist_gradient_boosting._bitset",
sources=["_hist_gradient_boosting/_bitset.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension("_hist_gradient_boosting.common",
sources=["_hist_gradient_boosting/common.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension("_hist_gradient_boosting.utils",
sources=["_hist_gradient_boosting/utils.pyx"],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_subpackage("_hist_gradient_boosting.tests")
diff --git a/sklearn/feature_extraction/setup.py b/sklearn/feature_extraction/setup.py
index 8c3bbb100..a872c7603 100644
--- a/sklearn/feature_extraction/setup.py
+++ b/sklearn/feature_extraction/setup.py
@@ -3,7 +3,7 @@ import platform
def configuration(parent_package='', top_path=None):
- import numpy
+ import numpy, os
from numpy.distutils.misc_util import Configuration
config = Configuration('feature_extraction', parent_package, top_path)
@@ -14,7 +14,7 @@ def configuration(parent_package='', top_path=None):
if platform.python_implementation() != 'PyPy':
config.add_extension('_hashing_fast',
sources=['_hashing_fast.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_subpackage("tests")
diff --git a/sklearn/linear_model/setup.py b/sklearn/linear_model/setup.py
index d0c9e8c04..962340210 100644
--- a/sklearn/linear_model/setup.py
+++ b/sklearn/linear_model/setup.py
@@ -1,5 +1,5 @@
import os
-import numpy
+import numpy, os
from sklearn._build_utils import gen_from_templates
@@ -15,12 +15,12 @@ def configuration(parent_package='', top_path=None):
config.add_extension('_cd_fast',
sources=['_cd_fast.pyx'],
- include_dirs=numpy.get_include(),
+ include_dirs=os.environ["NUMPY_INCLUDE_PATH"],
libraries=libraries)
config.add_extension('_sgd_fast',
sources=['_sgd_fast.pyx'],
- include_dirs=numpy.get_include(),
+ include_dirs=os.environ["NUMPY_INCLUDE_PATH"],
libraries=libraries)
# generate sag_fast from template
@@ -29,7 +29,7 @@ def configuration(parent_package='', top_path=None):
config.add_extension('_sag_fast',
sources=['_sag_fast.pyx'],
- include_dirs=numpy.get_include())
+ include_dirs=os.environ["NUMPY_INCLUDE_PATH"])
# add other directories
config.add_subpackage('tests')
diff --git a/sklearn/manifold/setup.py b/sklearn/manifold/setup.py
index 0db2d5d04..959a4996a 100644
--- a/sklearn/manifold/setup.py
+++ b/sklearn/manifold/setup.py
@@ -1,6 +1,6 @@
import os
-import numpy
+import numpy, os
def configuration(parent_package="", top_path=None):
@@ -14,13 +14,13 @@ def configuration(parent_package="", top_path=None):
config.add_extension("_utils",
sources=["_utils.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries,
extra_compile_args=["-O3"])
config.add_extension("_barnes_hut_tsne",
sources=["_barnes_hut_tsne.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries,
extra_compile_args=['-O3'])
diff --git a/sklearn/metrics/cluster/setup.py b/sklearn/metrics/cluster/setup.py
index c39e414d9..98640b5f3 100644
--- a/sklearn/metrics/cluster/setup.py
+++ b/sklearn/metrics/cluster/setup.py
@@ -1,6 +1,6 @@
import os
-import numpy
+import numpy, os
from numpy.distutils.misc_util import Configuration
@@ -11,7 +11,7 @@ def configuration(parent_package="", top_path=None):
libraries.append('m')
config.add_extension("_expected_mutual_info_fast",
sources=["_expected_mutual_info_fast.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_subpackage("tests")
diff --git a/sklearn/neighbors/setup.py b/sklearn/neighbors/setup.py
index 926404467..aeedcb940 100644
--- a/sklearn/neighbors/setup.py
+++ b/sklearn/neighbors/setup.py
@@ -2,7 +2,7 @@ import os
def configuration(parent_package='', top_path=None):
- import numpy
+ import numpy, os
from numpy.distutils.misc_util import Configuration
config = Configuration('neighbors', parent_package, top_path)
@@ -12,28 +12,27 @@ def configuration(parent_package='', top_path=None):
config.add_extension('_ball_tree',
sources=['_ball_tree.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension('_kd_tree',
sources=['_kd_tree.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension('_dist_metrics',
sources=['_dist_metrics.pyx'],
- include_dirs=[numpy.get_include(),
- os.path.join(numpy.get_include(),
- 'numpy')],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"],
+ os.path.join(os.environ["NUMPY_INCLUDE_PATH"], 'numpy')],
libraries=libraries)
config.add_extension('_typedefs',
sources=['_typedefs.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension("_quad_tree",
sources=["_quad_tree.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_subpackage('tests')
diff --git a/sklearn/preprocessing/setup.py b/sklearn/preprocessing/setup.py
index 29dae9b8f..7c059d90f 100644
--- a/sklearn/preprocessing/setup.py
+++ b/sklearn/preprocessing/setup.py
@@ -2,7 +2,7 @@ import os
def configuration(parent_package='', top_path=None):
- import numpy
+ import numpy, os
from numpy.distutils.misc_util import Configuration
config = Configuration('preprocessing', parent_package, top_path)
@@ -12,7 +12,7 @@ def configuration(parent_package='', top_path=None):
config.add_extension('_csr_polynomial_expansion',
sources=['_csr_polynomial_expansion.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_subpackage('tests')
diff --git a/sklearn/setup.py b/sklearn/setup.py
index e5d7e6e26..a814bca87 100644
--- a/sklearn/setup.py
+++ b/sklearn/setup.py
@@ -6,7 +6,7 @@ from sklearn._build_utils import cythonize_extensions
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
- import numpy
+ import numpy, os
libraries = []
if os.name == 'posix':
@@ -69,7 +69,7 @@ def configuration(parent_package='', top_path=None):
# add cython extension module for isotonic regression
config.add_extension('_isotonic',
sources=['_isotonic.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries,
)
diff --git a/sklearn/svm/setup.py b/sklearn/svm/setup.py
index dffcff8eb..d01614780 100644
--- a/sklearn/svm/setup.py
+++ b/sklearn/svm/setup.py
@@ -1,6 +1,6 @@
import os
from os.path import join
-import numpy
+import numpy, os
def configuration(parent_package='', top_path=None):
@@ -13,7 +13,7 @@ def configuration(parent_package='', top_path=None):
# newrand wrappers
config.add_extension('_newrand',
sources=['_newrand.pyx'],
- include_dirs=[numpy.get_include(),
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"],
join('src', 'newrand')],
depends=[join('src', 'newrand', 'newrand.h')],
language='c++',
@@ -34,6 +34,7 @@ def configuration(parent_package='', top_path=None):
extra_link_args=['-lstdc++'],
# Use C++11 to use the random number generator fix
extra_compiler_args=['-std=c++11'],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
)
libsvm_sources = ['_libsvm.pyx']
@@ -45,7 +46,7 @@ def configuration(parent_package='', top_path=None):
config.add_extension('_libsvm',
sources=libsvm_sources,
- include_dirs=[numpy.get_include(),
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"],
join('src', 'libsvm'),
join('src', 'newrand')],
libraries=['libsvm-skl'],
@@ -82,7 +83,7 @@ def configuration(parent_package='', top_path=None):
include_dirs=[join('.', 'src', 'liblinear'),
join('.', 'src', 'newrand'),
join('..', 'utils'),
- numpy.get_include()],
+ os.environ["NUMPY_INCLUDE_PATH"]],
depends=liblinear_depends,
# extra_compile_args=['-O0 -fno-inline'],
)
@@ -93,7 +94,7 @@ def configuration(parent_package='', top_path=None):
libsvm_sparse_sources = ['_libsvm_sparse.pyx']
config.add_extension('_libsvm_sparse', libraries=['libsvm-skl'],
sources=libsvm_sparse_sources,
- include_dirs=[numpy.get_include(),
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"],
join("src", "libsvm"),
join("src", "newrand")],
depends=[join("src", "libsvm", "svm.h"),
diff --git a/sklearn/tree/setup.py b/sklearn/tree/setup.py
index 079ae9d86..0308a5cf9 100644
--- a/sklearn/tree/setup.py
+++ b/sklearn/tree/setup.py
@@ -1,6 +1,6 @@
import os
-import numpy
+import numpy, os
from numpy.distutils.misc_util import Configuration
@@ -11,22 +11,22 @@ def configuration(parent_package="", top_path=None):
libraries.append('m')
config.add_extension("_tree",
sources=["_tree.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries,
extra_compile_args=["-O3"])
config.add_extension("_splitter",
sources=["_splitter.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries,
extra_compile_args=["-O3"])
config.add_extension("_criterion",
sources=["_criterion.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries,
extra_compile_args=["-O3"])
config.add_extension("_utils",
sources=["_utils.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries,
extra_compile_args=["-O3"])
diff --git a/sklearn/utils/setup.py b/sklearn/utils/setup.py
index 098adeecc..d24e1b1c8 100644
--- a/sklearn/utils/setup.py
+++ b/sklearn/utils/setup.py
@@ -5,7 +5,7 @@ from sklearn._build_utils import gen_from_templates
def configuration(parent_package='', top_path=None):
- import numpy
+ import numpy, os
from numpy.distutils.misc_util import Configuration
config = Configuration('utils', parent_package, top_path)
@@ -24,7 +24,7 @@ def configuration(parent_package='', top_path=None):
config.add_extension('arrayfuncs',
sources=['arrayfuncs.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension('murmurhash',
@@ -34,12 +34,12 @@ def configuration(parent_package='', top_path=None):
config.add_extension('graph_shortest_path',
sources=['graph_shortest_path.pyx'],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension('_fast_dict',
sources=['_fast_dict.pyx'],
language="c++",
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension('_openmp_helpers',
@@ -53,21 +53,21 @@ def configuration(parent_package='', top_path=None):
config.add_extension('_seq_dataset',
sources=['_seq_dataset.pyx'],
- include_dirs=[numpy.get_include()])
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]])
config.add_extension('_weight_vector',
sources=['_weight_vector.pyx'],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension("_random",
sources=["_random.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_extension("_logistic_sigmoid",
sources=["_logistic_sigmoid.pyx"],
- include_dirs=[numpy.get_include()],
+ include_dirs=[os.environ["NUMPY_INCLUDE_PATH"]],
libraries=libraries)
config.add_subpackage('tests')
|