Skip to content

Fixed import error message when extensions not built #52674

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 3 commits into from
Apr 14, 2023
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
12 changes: 5 additions & 7 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,18 @@
)
del _hard_dependencies, _dependency, _missing_dependencies

# numpy compat
from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401

try:
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
# numpy compat
from pandas.compat import (
is_numpy_dev as _is_numpy_dev, # pyright: ignore # noqa:F401
)
except ImportError as _err: # pragma: no cover
_module = _err.name
raise ImportError(
f"C extension: {_module} not built. If you want to import "
"pandas from the source directory, you may need to run "
"'python setup.py build_ext --force' to build the C extensions first."
"'python setup.py build_ext' to build the C extensions first."
) from _err
else:
del _tslib, _lib, _hashtable

from pandas._config import (
get_option,
Expand Down