Skip to content

MAINT: Nicely inform users if they're missing hard dependencies. #12468

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

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 14 additions & 1 deletion pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@

__docformat__ = 'restructuredtext'

# Let users know if they're missing any of our hard dependencies, ie. don't fail fast.
hard_dependencies = ("numpy", "pytz", "dateutil")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this line back (as it put .np in the pandas namespace)

missing_dependencies = []

for dependency in hard_dependencies:
try:
__import__(dependency)
except ImportError as e:
missing_dependencies.append(dependency)

if missing_dependencies:
raise ImportError("Missing required dependencies {0}".format(missing_dependencies))


# numpy compat
import numpy as np
from pandas.compat.numpy_compat import *

try:
Expand Down