Skip to content

Commit 870f890

Browse files
meeseeksmachinejorisvandenbossche
authored andcommitted
Backport PR #25568: BLD: Fixed pip install with no numpy (#25578)
1 parent f99f44a commit 870f890

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
@@ -472,6 +472,11 @@ def maybe_cythonize(extensions, *args, **kwargs):
472472
# Avoid running cythonize on `python setup.py clean`
473473
# See https://github.com/cython/cython/issues/1495
474474
return extensions
475+
if not cython:
476+
# Avoid trying to look up numpy when installing from sdist
477+
# https://github.com/pandas-dev/pandas/issues/25193
478+
# TODO: See if this can be removed after pyproject.toml added.
479+
return extensions
475480

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

483-
if cython:
484-
build_ext.render_templates(_pxifiles)
485-
return cythonize(extensions, *args, **kwargs)
486-
else:
487-
return extensions
488+
build_ext.render_templates(_pxifiles)
489+
return cythonize(extensions, *args, **kwargs)
488490

489491

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

0 commit comments

Comments
 (0)