Skip to content

Commit a07c7b9

Browse files
TomAugspurgerjreback
authored andcommitted
BLD: Fixed pip install with no numpy (#25568)
1 parent 1c72dda commit a07c7b9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

doc/source/whatsnew/v0.24.2.rst

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Fixed Regressions
3030
- Fixed regression in :class:`TimedeltaIndex` where ``np.sum(index)`` incorrectly returned a zero-dimensional object instead of a scalar (:issue:`25282`)
3131
- Fixed regression in ``IntervalDtype`` construction where passing an incorrect string with 'Interval' as a prefix could result in a ``RecursionError``. (:issue:`25338`)
3232
- Fixed regression in :class:`Categorical`, where constructing it from a categorical ``Series`` and an explicit ``categories=`` that differed from that in the ``Series`` created an invalid object which could trigger segfaults. (:issue:`25318`)
33+
- Fixed pip installing from source into an environment without NumPy (:issue:`25193`)
3334

3435
.. _whatsnew_0242.enhancements:
3536

setup.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,11 @@ def maybe_cythonize(extensions, *args, **kwargs):
477477
# Avoid running cythonize on `python setup.py clean`
478478
# See https://github.com/cython/cython/issues/1495
479479
return extensions
480+
if not cython:
481+
# Avoid trying to look up numpy when installing from sdist
482+
# https://github.com/pandas-dev/pandas/issues/25193
483+
# TODO: See if this can be removed after pyproject.toml added.
484+
return extensions
480485

481486
numpy_incl = pkg_resources.resource_filename('numpy', 'core/include')
482487
# TODO: Is this really necessary here?
@@ -485,11 +490,8 @@ def maybe_cythonize(extensions, *args, **kwargs):
485490
numpy_incl not in ext.include_dirs):
486491
ext.include_dirs.append(numpy_incl)
487492

488-
if cython:
489-
build_ext.render_templates(_pxifiles)
490-
return cythonize(extensions, *args, **kwargs)
491-
else:
492-
return extensions
493+
build_ext.render_templates(_pxifiles)
494+
return cythonize(extensions, *args, **kwargs)
493495

494496

495497
def srcpath(name=None, suffix='.pyx', subdir='src'):

0 commit comments

Comments
 (0)