Skip to content

BLD: more informative error message when trying to cythonize with old cython version #30774

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
Merged
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
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ def is_platform_mac():
try:
import Cython

ver = Cython.__version__
_CYTHON_VERSION = Cython.__version__
from Cython.Build import cythonize

_CYTHON_INSTALLED = ver >= LooseVersion(min_cython_ver)
_CYTHON_INSTALLED = _CYTHON_VERSION >= LooseVersion(min_cython_ver)
except ImportError:
_CYTHON_VERSION = None
_CYTHON_INSTALLED = False
cythonize = lambda x, *args, **kwargs: x # dummy func

Expand Down Expand Up @@ -506,6 +507,11 @@ def maybe_cythonize(extensions, *args, **kwargs):

elif not cython:
# GH#28836 raise a helfpul error message
if _CYTHON_VERSION:
raise RuntimeError(
f"Cannot cythonize with old Cython version ({_CYTHON_VERSION} "
f"installed, needs {min_cython_ver})"
)
raise RuntimeError("Cannot cythonize without Cython installed.")

numpy_incl = pkg_resources.resource_filename("numpy", "core/include")
Expand Down