Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: macOS: PyPy 3.8 (v7.3.9) threading get_native_id Broken #24094

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
ax3l opened this issue Oct 5, 2022 · 3 comments · Fixed by #24178
Closed

[Bug]: macOS: PyPy 3.8 (v7.3.9) threading get_native_id Broken #24094

ax3l opened this issue Oct 5, 2022 · 3 comments · Fixed by #24178
Milestone

Comments

@ax3l
Copy link

ax3l commented Oct 5, 2022

Bug summary

In PyPy 3.8 (v7.3.9), matplotlib 3.6.0 is cannot be imported, leading to breakage.

Ref.: https://foss.heptapod.net/pypy/pypy/-/issues/3764

Code for reproduction

import matplotlib.pyplot as plt

Actual outcome

AttributeError: module 'threading' has no attribute 'get_native_id'

in matplotlib/pyplot.py:337

     def _warn_if_gui_out_of_main_thread():
         # This compares native thread ids because even if python-level Thread
         # objects match, the underlying OS thread (which is what really matters)
         # may be different on Python implementations with green threads.
         if (_get_required_interactive_framework(_get_backend_mod()) and
 >               threading.get_native_id() != threading.main_thread().native_id):
 E               AttributeError: module 'threading' has no attribute 'get_native_id'

Expected outcome

Work as usual.

Additional information

This has been first posted in PyPy: https://foss.heptapod.net/pypy/pypy/-/issues/3764

I saw this on Conda-Forge, starting a few weeks ago as they shipped the latest PyPy 3.8.

Operating system

macOS 11.7 (x86_64) via Azure Pipelines 14 Runner

Matplotlib Version

3.6.0

Matplotlib Backend

default

Python version

PyPy 3.8 (v7.3.9)

Jupyter version

N/A

Installation

conda

@QuLogic
Copy link
Member

QuLogic commented Oct 14, 2022

@anntzer should we just fall back to the previous thread ID implementation when get_native_id is unavailable?

@anntzer
Copy link
Contributor

anntzer commented Oct 14, 2022

I would guess that's better than nothing? This was added in #23445 to better support green threads, which may not really be a problem with pypy anyways? (I don't know if such threading libraries exist for pypy...)

QuLogic added a commit to QuLogic/matplotlib that referenced this issue Oct 15, 2022
This is mainly for the benefit of PyPy.

Fixes matplotlib#24094
@ax3l
Copy link
Author

ax3l commented Oct 15, 2022

Thank you all for the fix! 🎉

chahak13 pushed a commit to chahak13/matplotlib that referenced this issue Oct 18, 2022
This is mainly for the benefit of PyPy.

Fixes matplotlib#24094
pratimugale pushed a commit to pratimugale/matplotlib that referenced this issue Oct 24, 2022
This is mainly for the benefit of PyPy.

Fixes matplotlib#24094
melissawm pushed a commit to melissawm/matplotlib that referenced this issue Dec 19, 2022
This is mainly for the benefit of PyPy.

Fixes matplotlib#24094
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants