Repository: ipython/ipython

Issue:
python crashes when importing matplotlib in terminal mode on m1 mac
Hello community, 

I am experiencing the following crash when trying to plot from the command line on my M1 mac:

```
(base) ➜  ~ ipython
Python 3.9.1 | packaged by conda-forge | (default, Jan 26 2021, 01:30:54) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.20.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import matplotlib

In [2]: matplotlib.get_backend()
Out[2]: 'MacOSX'

In [3]: [1]    2797 bus error  ipython
```

Even more weird, if I try to set any value of `c.InteractiveShellApp.matplotlib` in the `ipython_config.py`, the crash occurs instantly (that is, when ipython starts). In "vanilla" python REPL, everything works as expected.

My ipython (7.20.0) and matplotlib (3.3.4) are installed through conda and this is otherwise a "fresh" install. 

Any help is appreciated! 


Discussion:
Unfortunately, we don't have any resources to do native testing on this platform combination. You might need to get friendly with `strace` (if there is such a thing on osx) to provide more information.

- do you get the same error with another ipython, e.g. 7.19?
- do you get the same error with another python, e.g. 3.8?

In the meanwhile, a full `conda list --explicit` might help point some stuff out.
> Unfortunately, we don't have any resources to do native testing on this platform combination. You might need to get friendly with `strace` (if there is such a thing on osx) to provide more information.

That is completely understandable @bollwyvl! 

Google tells me that macos ships with `dtruss` - a tool similar to `strace`. However, to run it, I need to reboot into recovery and disable system integrity protection. As it is a project on it's own, I will look into it later.

> * do you get the same error with another ipython, e.g. 7.19?

Yes, I had the same error in 7.19.

> * do you get the same error with another python, e.g. 3.8?

Yes.

> In the meanwhile, a full `conda list --explicit` might help point some stuff out.

Here is some relevant output of that command:

<details>
<pre>
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-arm64
@EXPLICIT
https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h27ca646_4.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/c-ares-1.17.1-h27ca646_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/ca-certificates-2020.12.5-h4653dfc_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/jpeg-9d-h27ca646_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libcxx-11.0.1-h168391b_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libev-4.33-h642e427_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libsodium-1.0.18-h27ca646_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libuv-1.40.0-h27ca646_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libwebp-base-1.2.0-h27ca646_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/llvm-openmp-11.0.1-hb3022d6_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.2-h9aa5885_4.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/rhash-1.4.1-h27ca646_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/tzdata-2021a-he74cb21_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/xz-5.2.5-h642e427_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/yaml-0.2.5-h642e427_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/zlib-1.2.11-h31e879b_1009.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/expat-2.2.10-h9f76cd9_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libedit-3.1.20191231-hc8eb9b7_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libffi-3.3-h9f76cd9_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libgfortran5-11.0.0.dev0-hdc626ea_17.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libpng-1.6.37-hf7e6567_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/lz4-c-1.9.3-h9f76cd9_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/ninja-1.10.2-h4d860bb_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/openssl-1.1.1i-h27ca646_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.0-hc8eb9b7_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/tk-8.6.10-hf7e6567_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/zeromq-4.3.3-h9f76cd9_3.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/freetype-2.10.4-h17b34a0_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/krb5-1.17.2-h17618d6_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libgfortran-5.0.0.dev0-11_0_0_hdc626ea_17.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libnghttp2-1.41.0-h87e4072_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libssh2-1.9.0-h1c49ba1_5.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/sqlite-3.34.0-h6d56c25_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/zstd-1.4.8-h5b28eab_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libcurl-7.71.1-hd2aec06_8.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libopenblas-0.3.12-openmp_h2ecc587_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libtiff-4.2.0-h70663a0_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/python-3.9.1-hcbd9b3a_5_cpython.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/async_generator-1.10-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/attrs-20.3.0-pyhd3deb0d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/backcall-0.2.0-pyh9f0ad1d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/backports-1.0-py_2.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/cached-property-1.5.1-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/cmake-3.19.4-h60611b0_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/decorator-4.4.2-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/defusedxml-0.6.0-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/entrypoints-0.3-pyhd8ed1ab_1003.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/hdf5-1.10.6-nompi_h0fc092c_1114.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/idna-2.10-pyh9f0ad1d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/ipython_genutils-0.2.0-py_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/json5-0.9.5-pyh9f0ad1d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/jupyterlab_widgets-1.0.0-pyhd8ed1ab_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/lcms2-2.11-h2f7874f_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libblas-3.9.0-7_openblas.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/nest-asyncio-1.4.3-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/olefile-0.46-pyh9f0ad1d_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pandocfilters-1.4.2-py_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/parso-0.8.1-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pickleshare-0.7.5-py_1003.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/prometheus_client-0.9.0-pyhd3deb0d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/ptyprocess-0.7.0-pyhd3deb0d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pycparser-2.20-pyh9f0ad1d_2.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pyparsing-2.4.7-pyh9f0ad1d_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/python_abi-3.9-1_cp39.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pytz-2021.1-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/send2trash-1.5.0-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/six-1.15.0-pyh9f0ad1d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/testpath-0.4.4-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/threadpoolctl-2.1.0-pyh5ca1d4c_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/tqdm-4.56.0-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/webencodings-0.5.1-py_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/wheel-0.36.2-pyhd3deb0d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/zipp-3.4.0-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/appnope-0.1.2-py39h2804cbe_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/babel-2.9.0-pyhd3deb0d_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/certifi-2020.12.5-py39h2804cbe_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/cffi-1.14.4-py39h702c04f_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/chardet-4.0.0-py39h2804cbe_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/conda-package-handling-1.7.2-py39h51e6412_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/cycler-0.10.0-py_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/importlib-metadata-3.4.0-py39h2804cbe_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/jedi-0.18.0-py39h2804cbe_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/kiwisolver-1.3.1-py39h5a63225_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/libcblas-3.9.0-7_openblas.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/liblapack-3.9.0-7_openblas.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/markupsafe-1.1.1-py39h46acfd9_3.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/mistune-0.8.4-py39h46acfd9_1003.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/packaging-20.8-pyhd3deb0d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pexpect-4.8.0-pyh9f0ad1d_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/pillow-8.1.0-py39hfbe1b89_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/pycosat-0.6.3-py39h46acfd9_1006.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/pyrsistent-0.17.3-py39h46acfd9_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/pysocks-1.7.1-py39h2804cbe_3.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/python-dateutil-2.8.1-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/pyyaml-5.4.1-py39h46acfd9_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/pyzmq-20.0.0-py39hc82af31_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/ruamel_yaml-0.15.80-py39h46acfd9_1004.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/sniffio-1.2.0-py39h2804cbe_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/tornado-6.1-py39h46acfd9_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/traitlets-5.0.5-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/anyio-2.0.2-py39h2804cbe_4.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/argon2-cffi-20.1.0-py39h46acfd9_2.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/brotlipy-0.7.0-py39h46acfd9_1001.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/cryptography-3.3.1-py39h0bed37e_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/importlib_metadata-3.4.0-hd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/jupyter_core-4.7.1-py39h2804cbe_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/numpy-1.20.0-py39h69a04d8_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/setuptools-49.6.0-py39h2804cbe_3.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/terminado-0.9.2-py39h2804cbe_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/backports.functools_lru_cache-1.6.1-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/bleach-3.3.0-pyh44b312d_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/h5py-3.1.0-nompi_py39h99babb8_100.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/jinja2-2.11.3-pyh44b312d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/joblib-1.0.0-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/jsonschema-3.2.0-py_2.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/jupyter_client-6.1.11-pyhd8ed1ab_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/matplotlib-base-3.3.4-py39h3e8bbd8_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/pandas-1.2.1-py39ha4bedbf_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pip-21.0.1-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pygments-2.7.4-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/pyopenssl-20.0.1-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/scipy-1.6.0-py39h73ea49b_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/hdf5storage-0.1.15-py_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/jupyterlab_pygments-0.1.2-pyh9f0ad1d_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/matplotlib-3.3.4-py39hdf13c20_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/nbformat-5.1.2-pyhd8ed1ab_1.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/scikit-learn-0.24.1-py39hb966dd2_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/urllib3-1.26.3-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/wcwidth-0.2.5-pyh9f0ad1d_2.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/nbclient-0.5.1-py_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/prompt-toolkit-3.0.14-pyha770c72_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/requests-2.25.1-pyhd3deb0d_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/conda-4.9.2-py39h2804cbe_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/ipython-7.20.0-py39h32adebf_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/nbconvert-6.0.7-py39h2804cbe_3.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/ipykernel-5.4.3-py39h32adebf_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/jupyter_server-1.2.3-py39h2804cbe_1.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/jupyterlab_server-2.1.3-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/notebook-6.2.0-py39h2804cbe_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/nbclassic-0.2.6-pyhd8ed1ab_0.tar.bz2
https://conda.anaconda.org/conda-forge/osx-arm64/widgetsnbextension-3.5.1-py39h2804cbe_4.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/ipywidgets-7.6.3-pyhd3deb0d_0.tar.bz2
https://conda.anaconda.org/conda-forge/noarch/jupyterlab-3.0.6-pyhd8ed1ab_0.tar.bz2
</pre>
</details>

Thanks very much for your reply and willingness to help me! 


woof, what a brutal thing to do between a developer and their machine.

but for real, posting a link to a gist of all of `conda list --explicit` (or putting it in `<details><pre></pre></details>`) is actually what we'd need to do anything more than cosmetic.
> woof, what a brutal thing to do between a developer and their machine.

I am cheering for the *Linux on M1* project. For real, mac os is getting more and more annoying with every release. There is this thing now, where they submit the hash of every single unsigned binary to the mothership for 'verification'. 

> but for real, posting a link to a gist of all of `conda list --explicit` (or putting it in `<details><pre></pre></details>`) is actually what we'd need to do anything more than cosmetic.

I've edited my previous comment! 


Here's a backtrace,
```
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x10792c460)
  * frame #0: 0x000000010792c460
    frame #1: 0x00000001a26aa2f0 CoreFoundation`CFFileDescriptorInvalidate + 308
    frame #2: 0x00000001aef90050 libffi.dylib`ffi_call_SYSV + 80
    frame #3: 0x00000001aef989d8 libffi.dylib`ffi_call_int + 944
    frame #4: 0x000000010797876c _ctypes.cpython-39-darwin.so`_ctypes_callproc + 1236
    frame #5: 0x0000000107972b90 _ctypes.cpython-39-darwin.so`PyCFuncPtr_call + 1196
    frame #6: 0x00000001000600b8 python`_PyObject_MakeTpCall + 340
    frame #7: 0x0000000100168c00 python`call_function + 724
    frame #8: 0x0000000100165318 python`_PyEval_EvalFrameDefault + 29396
    frame #9: 0x0000000100060dc4 python`function_code_fastcall + 116
    frame #10: 0x0000000107976b90 _ctypes.cpython-39-darwin.so`closure_fcn + 648
    frame #11: 0x00000001aef98e10 libffi.dylib`ffi_closure_SYSV_inner + 800
    frame #12: 0x00000001aef901e8 libffi.dylib`ffi_closure_SYSV + 56
    frame #13: 0x00000001a26970f8 CoreFoundation`__CFFileDescriptorPerform + 356
    frame #14: 0x00000001a262bc04 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
    frame #15: 0x00000001a262bb50 CoreFoundation`__CFRunLoopDoSource0 + 208
    frame #16: 0x00000001a262b83c CoreFoundation`__CFRunLoopDoSources0 + 268
    frame #17: 0x00000001a262a1d4 CoreFoundation`__CFRunLoopRun + 824
    frame #18: 0x00000001a2629730 CoreFoundation`CFRunLoopRunSpecific + 600
    frame #19: 0x00000001aa132f0c HIToolbox`RunCurrentEventLoopInMode + 292
    frame #20: 0x00000001aa132bcc HIToolbox`ReceiveNextEventCommon + 320
    frame #21: 0x00000001aa132a6c HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 76
    frame #22: 0x00000001a4dfedb0 AppKit`_DPSNextEvent + 868
    frame #23: 0x00000001a4dfd730 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1312
    frame #24: 0x00000001a4def58c AppKit`-[NSApplication run] + 600
    frame #25: 0x00000001aef90050 libffi.dylib`ffi_call_SYSV + 80
    frame #26: 0x00000001aef989d8 libffi.dylib`ffi_call_int + 944
    frame #27: 0x000000010797876c _ctypes.cpython-39-darwin.so`_ctypes_callproc + 1236
    frame #28: 0x0000000107972b90 _ctypes.cpython-39-darwin.so`PyCFuncPtr_call + 1196
    frame #29: 0x00000001000600b8 python`_PyObject_MakeTpCall + 340
    frame #30: 0x0000000100168c00 python`call_function + 724
    frame #31: 0x0000000100165318 python`_PyEval_EvalFrameDefault + 29396
    frame #32: 0x0000000100060dc4 python`function_code_fastcall + 116
    frame #33: 0x0000000100168b68 python`call_function + 572
    frame #34: 0x0000000100165298 python`_PyEval_EvalFrameDefault + 29268
    frame #35: 0x000000010015d9fc python`_PyEval_EvalCode + 2968
    frame #36: 0x0000000100060d44 python`_PyFunction_Vectorcall + 240
    frame #37: 0x0000000100168b68 python`call_function + 572
    frame #38: 0x000000010016527c python`_PyEval_EvalFrameDefault + 29240
    frame #39: 0x0000000100060dc4 python`function_code_fastcall + 116
    frame #40: 0x0000000100168b68 python`call_function + 572
    frame #41: 0x000000010016527c python`_PyEval_EvalFrameDefault + 29240
    frame #42: 0x0000000100060dc4 python`function_code_fastcall + 116
    frame #43: 0x0000000100168b68 python`call_function + 572
    frame #44: 0x000000010016527c python`_PyEval_EvalFrameDefault + 29240
    frame #45: 0x0000000100060dc4 python`function_code_fastcall + 116
    frame #46: 0x0000000100168b68 python`call_function + 572
    frame #47: 0x000000010016527c python`_PyEval_EvalFrameDefault + 29240
    frame #48: 0x000000010015d9fc python`_PyEval_EvalCode + 2968
    frame #49: 0x0000000100060d44 python`_PyFunction_Vectorcall + 240
    frame #50: 0x0000000100063bc0 python`method_vectorcall + 164
    frame #51: 0x0000000100168b68 python`call_function + 572
    frame #52: 0x0000000100165394 python`_PyEval_EvalFrameDefault + 29520
    frame #53: 0x000000010015d9fc python`_PyEval_EvalCode + 2968
    frame #54: 0x0000000100060d44 python`_PyFunction_Vectorcall + 240
    frame #55: 0x0000000100063bc0 python`method_vectorcall + 164
    frame #56: 0x000000010006093c python`PyVectorcall_Call + 156
    frame #57: 0x00000001001655cc python`_PyEval_EvalFrameDefault + 30088
    frame #58: 0x0000000100060dc4 python`function_code_fastcall + 116
    frame #59: 0x0000000100168b68 python`call_function + 572
    frame #60: 0x000000010016527c python`_PyEval_EvalFrameDefault + 29240
    frame #61: 0x000000010015d9fc python`_PyEval_EvalCode + 2968
    frame #62: 0x0000000100060d44 python`_PyFunction_Vectorcall + 240
    frame #63: 0x0000000100168b68 python`call_function + 572
    frame #64: 0x000000010016527c python`_PyEval_EvalFrameDefault + 29240
    frame #65: 0x000000010015d9fc python`_PyEval_EvalCode + 2968
    frame #66: 0x0000000100060d44 python`_PyFunction_Vectorcall + 240
    frame #67: 0x0000000100168b68 python`call_function + 572
    frame #68: 0x000000010016527c python`_PyEval_EvalFrameDefault + 29240
    frame #69: 0x0000000100060dc4 python`function_code_fastcall + 116
    frame #70: 0x0000000100168b68 python`call_function + 572
    frame #71: 0x000000010016527c python`_PyEval_EvalFrameDefault + 29240
    frame #72: 0x000000010015d9fc python`_PyEval_EvalCode + 2968
    frame #73: 0x0000000100060d44 python`_PyFunction_Vectorcall + 240
    frame #74: 0x0000000100063bc0 python`method_vectorcall + 164
    frame #75: 0x000000010006093c python`PyVectorcall_Call + 156
    frame #76: 0x00000001001655cc python`_PyEval_EvalFrameDefault + 30088
    frame #77: 0x000000010015d9fc python`_PyEval_EvalCode + 2968
    frame #78: 0x0000000100060d44 python`_PyFunction_Vectorcall + 240
    frame #79: 0x0000000100168b68 python`call_function + 572
    frame #80: 0x0000000100165318 python`_PyEval_EvalFrameDefault + 29396
    frame #81: 0x000000010015d9fc python`_PyEval_EvalCode + 2968
    frame #82: 0x00000001001c0ed0 python`PyRun_FileExFlags + 464
    frame #83: 0x00000001001c01ac python`PyRun_SimpleFileExFlags + 436
    frame #84: 0x00000001001e2fc4 python`Py_RunMain + 2916
    frame #85: 0x00000001001e4138 python`pymain_main + 1256
    frame #86: 0x0000000100007520 python`main + 56
    frame #87: 0x00000001a254cf54 libdyld.dylib`start + 4
```
You know it's no good when @isuruf somehow gets in your computer...
:smile: we've got a DTK at conda-forge (which you are welcome to have access to).
I'm also able to replicate, though with a slightly different traceback.  But even more interestingly, this seems to work perfectly fine on regular `python`, it just crashes in `ipython`.  
> I'm also able to replicate, though with a slightly different traceback. But even more interestingly, this seems to work perfectly fine on regular `python`, it just crashes in `ipython`.

same here on M1, `python=3.8.6` all installed from `conda-forge`
My traceback says the problem is with:
```
2021-02-01 21:21:40.771 python[5471:2277374] *** Assertion failure in +[NSEvent otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:], NSEvent.m:737
2021-02-01 21:21:40.781 python[5471:2277374] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: _NSEventMask64FromType(type) & WeirdMask'
```
(I don't know what `WeirdMask` is ...)
And this is called here: https://github.com/matplotlib/matplotlib/blob/master/src/_macosx.m#L536-L550 and https://github.com/matplotlib/matplotlib/blob/master/src/_macosx.m#L1723-L1731 .  Now, following up on this I find that `otherEventWithType` is woefully under-documented, but https://developer.apple.com/documentation/appkit/nsevent/1530010-othereventwithtype says that "If type is anything else, an NSInternalInconsistencyException is raised. Your code should only create events of type NSApplicationDefined." which is suggestive (this is the error that my traceback has!) but also suggests `NSApplicationDefined` which is deprecated, but not on this documentation page.
matplotlib was a red herring.  The problem was in ipython, this PR fixes the crash: https://github.com/ipython/ipython/pull/12804
Thanks all, i've merged the linked PR in master; it should autobackport to 7.x that I'll try to release at end of month. 
This is the fastest response and an example of legendary cooperation. I love this community 

⭐ ⭐ ⭐ ⭐ ⭐  would recommend.
> This is the fastest response and an example of legendary cooperation. I love this community
> 
> ⭐ ⭐ ⭐ ⭐ ⭐ would recommend.

❤️💎👐

Not to steal the thunder of fixing this upstream, but we just merged a patch for conda-forge:

https://github.com/conda-forge/ipython-feedstock/pull/129

Builds are up, but might take a bit until they are available on CDN. @erykoff has tested it locally, but if  @eugene can check it out and (hopefully) close that would be great.

Thanks all!
> Builds are up, but might take a bit until they are available on CDN. @erykoff has tested it locally, but if @eugene can check it out and (hopefully) close that would be great.

I've just updated to `https://conda.anaconda.org/conda-forge/osx-arm64/ipython-7.20.0-py39h32adebf_1.tar.bz2` but still same crash :( 
Oh no ... there must be another problem.  I just confirmed that the new version works on python 3.8 but _not_ on python 3.9.  Back into the salt-mines for me.
Found it ... there was one more pointer list problem that I hadn't noticed.  PR incoming.

Resolving patch:
diff --git a/IPython/terminal/pt_inputhooks/osx.py b/IPython/terminal/pt_inputhooks/osx.py
--- a/IPython/terminal/pt_inputhooks/osx.py
+++ b/IPython/terminal/pt_inputhooks/osx.py
@@ -41,7 +41,7 @@ def C(classname):
 
 CFFileDescriptorCreate = CoreFoundation.CFFileDescriptorCreate
 CFFileDescriptorCreate.restype = void_p
-CFFileDescriptorCreate.argtypes = [void_p, ctypes.c_int, ctypes.c_bool, void_p]
+CFFileDescriptorCreate.argtypes = [void_p, ctypes.c_int, ctypes.c_bool, void_p, void_p]
 
 CFFileDescriptorGetNativeDescriptor = CoreFoundation.CFFileDescriptorGetNativeDescriptor
 CFFileDescriptorGetNativeDescriptor.restype = ctypes.c_int


Test patch: