Skip to content

Backport PR #25568 on branch 0.24.x (BLD: Fixed pip install with no numpy) #25578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Fixed Regressions
- Fixed regression in :class:`TimedeltaIndex` where ``np.sum(index)`` incorrectly returned a zero-dimensional object instead of a scalar (:issue:`25282`)
- Fixed regression in ``IntervalDtype`` construction where passing an incorrect string with 'Interval' as a prefix could result in a ``RecursionError``. (:issue:`25338`)
- 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`)
- Fixed pip installing from source into an environment without NumPy (:issue:`25193`)

.. _whatsnew_0242.enhancements:

Expand Down
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@ def maybe_cythonize(extensions, *args, **kwargs):
# Avoid running cythonize on `python setup.py clean`
# See https://github.com/cython/cython/issues/1495
return extensions
if not cython:
# Avoid trying to look up numpy when installing from sdist
# https://github.com/pandas-dev/pandas/issues/25193
# TODO: See if this can be removed after pyproject.toml added.
return extensions

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

if cython:
build_ext.render_templates(_pxifiles)
return cythonize(extensions, *args, **kwargs)
else:
return extensions
build_ext.render_templates(_pxifiles)
return cythonize(extensions, *args, **kwargs)


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