-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
sub-packages/sub-modules not (lazy) imported #22247
Comments
This looks like a messed up installation, but without further context we can't tell:
|
I think the installation is probably fine, just |
If you just import the top level module this is what gets pulled in:
Depending on the exact imports you have done @livecat-ai that attribute error may be the "correct" behavior.
matplotlib/lib/matplotlib/__init__.py Lines 1449 to 1451 in 76012ae
__init__.py .I think we should do two things here:
|
On a bit more inspection, we unavoidably must import We should still think about putting in lazy imports for all/a subset of the sub packages though. |
@livecat-ai I took the liberty of changing the description to something that is clearer. |
@tacaswell Thanks and thanks everyone for the clarification. I might be mistaken but lazy imports seemed to be the default behaviour in previous versions. If so, re-instating it would seem like a reasonable option in terms of compatibility across versions. |
We have not had lazy imports in the past, but it is possible that we did import more subpackages/modules on top level import in the past. If you import pyplot you get many more of the sub modules imported (94!) . I do not think we want to promote the exact set of modules imported as side-effects to a stable API. It is a very fiddly thing to track, there is a clear work-around on the user side (import the sub-module you want (which also leads to more readable user code)), and would constrain us if we wanted to improve import time by further reducing / re-arranging imports. |
I get AttributeError: module 'matplotlib' has no attribute 'dates', when trying to access date functions.
eg. mpl.dates.num2date(date + epoch_adjustment)
version: matplotlib-3.5.1-cp39-cp39-macosx_11_0_arm64.whl
The text was updated successfully, but these errors were encountered: