-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[Bug]: M1 Mac, maplotlib interactive fails #12164
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
Resolving in favor of the matplotlib issue linked above. |
@jweill-aws Sorry to play hot-potato but Matplotlib relies on IPython / Jupyter to run the GUI event loop integrated with prompt toolkit / tornado (which we must because we can not see into the context we are being run from). I am 99% sure that the issue in on the jupyter side. |
@tacaswell OK. Thank you for the additional info. I've reopened this issue. |
Thank you. Copying over a comment I left on the mpl side, I would try to get some other OSX UI to run in a jlab context to see it has the same problem. |
I'd suggest that this issue should be moved/reopened in the IPykernel repo, which is the package in charge of handling event loops for Jupyter. Furthermore, I guess this problem was introduced by the switch to |
From triage today: It is necessary to test whether this occurs in classic notebook on an M1 Mac. @ccordoba12 's suggestion about opening this in IPykernel is also worth considering especially if this bug occurs in both JupyterLab and classic notebook. @shiba24 Have you tried using matplotlib on your Mac with classic notebook? |
I can reproduce this using
I'm not sure how to do/test this, could you post (a link to) instructions? |
Ah, perhaps just running
|
Ok, great!
Just open again the issue in this repo: https://github.com/ipython/ipykernel, and close this one.
The mechanisms to handle event loops in IPython terminal and JupyterLab/notebook are totally different. That's why this bug needs to be solved in IPykernel. |
Thank you @dstansby for the info :) The command fails both in jupyter notebook and jupyter lab, with same error. But it works no problem in ipython. My environment are (not conda, pip)
|
@3coins can try to repro using the info from the original description. |
I am able to reproduce this in M1 Pro in JupyterLab 3.x. Here is some more info that was logged in addition to what @shiba24 reported.
Here is the notebook content, I used to reproduce this error.
|
I'm having the same issue with an M2 chip. Has anyone found a solution for this bug yet? |
@lin-shuyu That looks like a different issue as I do not see anything about the osx backend in that traceback and I suspect you are using the inline backend? I think the three relevant bits of code here are: ipykernl inputhook: https://github.com/ipython/ipykernel/blob/main/ipykernel/_eventloop_macos.py ipython inputphook: https://github.com/ipython/ipython/blob/main/IPython/terminal/pt_inputhooks/osx.py mpl's osx binding: https://github.com/matplotlib/matplotlib/blob/main/src/_macosx.m My first suspicion is that there is a bug in the ipykernel inputhook. It looks like in the IPython case it is waiting for the user to type something (which it can do because it is the terminal you are sitting in), however in the ipykernal case it is spinning the main loop for a fixed about of time. Rather than time-sharing with prompt-toolkit it is timesharing with tornado which may make a difference. See https://matplotlib.org/devdocs/users/explain/figure/interactive_guide.html for an explanation of what the input hooks do and why they have to exist. Given the wording in the errors I'm doubtful that Matplotlib is directly involved, but given that mpl builds an (objective) c extension, it is possible that there is something wrong with the wheels / conda package (the evidence one way or the other is if it reproduces with wheels but not when built from source). If you are crossing conda and wheels there can also be issues with extensions due to the limitations of the wheel metadata. I also have a suspicion that the M1/M2 chip issue is a red-herring and it is the version of OSX that matters (and the M1/M2 are always on a new enough OSX to be broken). |
I am having the same issue |
Not many ideas, but just highlighting that this issue might be mis-filed because the code for matplotlib/IPython/ipykernel is not in this repository and maintainers of JupyterLab do not necessarily have the expertise to help with issues that may come from other projects. In particular the issue above may arise from packaging problems where incompatible binaries are installed. My only suggestion is that if you installed using conda, try creating a new environment using native Python and install using pip (and vice versa) - if this helps please let us know as this will narrow it down to a packaging issue. Also, curious what python version you see the issue with. |
Macbook M3 I was using conda, I am going to give it a try to install everything with pip and I come back. |
Yes, I just reinstalled everything using pip in a new venv and same error
|
Can you try with the mpl 3.9.0rc ? ( |
This is a long-standing problem in |
Description
Hi, the matplotlib interactive figure in jupyter lab on Mac M1 is broken in my environment. I think this stackoverflow is the same issue.
https://stackoverflow.com/questions/70466222/m1-mac-python-assertion-failure-and-crashes-when-using-osx-as-backend-in-matplo
I posted the same issue in the matplotlib github repo: matplotlib/matplotlib#22545 and at least it is confirmed as reproducibly there.
Reproduce
Then you see endless lines of
Expected behavior
Matplotlib interactive figures:
https://matplotlib.org/stable/users/explain/interactive.html
Context
Thank you!
The text was updated successfully, but these errors were encountered: