Visitar URL original
Python 3.10.11 macOS: tk.h version (8.5) doesn't match libtk.a version (8.6) · Issue #649 · actions/setup-python · GitHub
Skip to content

Python 3.10.11 macOS: tk.h version (8.5) doesn't match libtk.a version (8.6) #649

Description

@QuLogic

Description:
Azure appears to be slowly rolling out image version 20230408.1. This seems to have hit our Python 3.10 jobs with the error:

RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)

This didn't affect the 3.9 job, which is also using the 20230408.1 image.

Action version:
0.214.0

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
3.10.11

Repro steps:
https://dev.azure.com/matplotlib/matplotlib/_build/results?buildId=32988&view=logs&j=de24e77b-0042-5832-9c98-cc3b6fa75eaf&t=6ee7601c-9c40-4d21-ae8c-c759c54cae95

Expected behavior:
Tk works correctly.

Actual behavior:
A runtime error is raised when attempting to import Tk:

RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)

Activity

  1. QuLogic commented on Apr 12, 2023

    @QuLogic
    Author

    This is a similar issue to #402.

  2. marko-zivic-93 commented on Apr 13, 2023

    @marko-zivic-93
    Contributor

    Hello @QuLogic
    Thank you for creating this issue, we will take a look at it and come back to you as soon as we have some results 🙂

  3. damies13 commented on Apr 27, 2023

    @damies13

    Just an FYI I'm encountering the same issue with my rfswarm builds, the issue seems to be specific to python 3.10 on MacOS

    Not sure how helpful this is but I'll add it in case it helps find the cause:

    OS Python Ver Test Result
    ubuntu-latest 3.7 Pass
    ubuntu-latest 3.8 Pass
    ubuntu-latest 3.9 Pass
    ubuntu-latest 3.10 Pass
    ubuntu-latest 3.11 Pass
    macos-latest 3.7 Pass
    macos-latest 3.8 Pass
    macos-latest 3.9 Pass
    macos-latest 3.10 Fail
    macos-latest 3.11 Pass
    windows-latest 3.7 Pass
    windows-latest 3.8 Pass
    windows-latest 3.9 Pass
    windows-latest 3.10 Pass
    windows-latest 3.11 Pass

    Here's my stack trace from stderr:

    Traceback (most recent call last):
      File "/Users/runner/work/rfswarm/rfswarm/rfswarm_manager/rfswarm.py", line 6954, in <module>
        core = RFSwarmCore()
      File "/Users/runner/work/rfswarm/rfswarm/rfswarm_manager/rfswarm.py", line 2223, in __init__
        base.gui = RFSwarmGUI()
      File "/Users/runner/work/rfswarm/rfswarm/rfswarm_manager/rfswarm.py", line 3216, in __init__
        self.root = tk.Tk()
      File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2301, in __init__
        self._loadtk()
      File "/Users/runner/hostedtoolcache/Python/3.10.11/x64/lib/python3.10/tkinter/__init__.py", line 2317, in _loadtk
        raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)"
    RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)
    
    

    A quick internet search for "RuntimeError: tk.h version (8.5) doesn't match libtk.a version (8.6)" brought me here.

    Let me know if I can be of any more help?

    Dave.

  4. petercorke commented on May 10, 2023

    @petercorke

    I'm seeing this also, Python 3.10 on macOS failing with a tk.h related error. I feel I've had this same thing a few years ago, maybe #402 mentioned above...

    My last good build was 29 March, and the configuration was:

    platform darwin -- Python 3.10.10, pytest-7.2.2, pluggy-1.0.0, matplotlib-3.7.1-cp310-cp310-macosx_10_12_x86_64.whl
    

    Currently the configuration is:

    platform darwin -- Python 3.10.11, pytest-7.3.1, pluggy-1.0.0, matplotlib-3.7.1-cp310-cp310-macosx_10_12_x86_64.whl
    

    Some change to Python version, no change to Matplotlib.

  5. QuLogic commented on Jun 15, 2023

    @QuLogic
    Author
  6. tacaswell commented on Jun 20, 2023

    @tacaswell
  7. vitahoang commented on Jun 23, 2023

    @vitahoang

    Try this solution https://stackoverflow.com/a/60469203/8239990

    # Install necessary system packages:
    brew install tcl-tk openssl readline sqlite3 xz zlib
    # Uninstall the current version
    export PY_VER=$(python --version | cut -d " " -f 2)    
    pyenv uninstall $(echo $PY_VER)
    # Link the correct versions of Tcl/Tk
    env LDFLAGS="-L$(brew --prefix openssl@1.1)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix sqlite3)/lib -L$(brew --prefix xz)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix tcl-tk)/lib" \
    CPPFLAGS="-I$(brew --prefix openssl@1.1)/include -I$(brew --prefix readline)/include -I$(brew --prefix sqlite3)/include -I$(brew --prefix xz)/include -I$(brew --prefix zlib)/include -I$(brew --prefix tcl-tk)/include" \
    PKG_CONFIG_PATH="$(brew --prefix openssl@1.1)/lib/pkgconfig:$(brew --prefix readline)/lib/pkgconfig:$(brew --prefix sqlite3)/lib/pkgconfig:$(brew --prefix xz)/lib/pkgconfig:$(brew --prefix zlib)/lib/pkgconfig:$(brew --prefix tcl-tk)/lib/pkgconfig" \
    PYTHON_CONFIGURE_OPTS="--with-tcltk-includes='-I$(brew --prefix tcl-tk)/include' --with-tcltk-libs='-L$(brew --prefix tcl-tk)/lib -ltcl8.6 -ltk8.6'" \
    pyenv install $(echo $PY_VER)
    
    
  8. albertosottile commented on Jul 14, 2023

    @albertosottile

    Has anyone found a solution for this? I am currently unable to build any 3.8 version with proper tk support on macOS... I tried to use the environment tricks, but none of them works, pyenv still somehow picks the header from the system and not for homebrew.

  9. vitahoang commented on Jul 14, 2023

    @vitahoang

    Has anyone found a solution for this? I am currently unable to build any 3.8 version with proper tk support on macOS... I tried to use the environment tricks, but none of them works, pyenv still somehow picks the header from the system and not for homebrew.

    Have you try my suggestion above? I use it to successfully set up python 3.8 -> 3.11.

  10. 21 remaining items

  11. carlosperate commented on Dec 26, 2024

    @carlosperate

    Thanks @priya-kinthali, I can confirm the following:

    • As stated, Python 3.9.21 and 3.10.26 work, however, they are not available for the macOS 13 images (perhaps because they are Intel macs?)
      • So in macOS 13 Tk in Python 3.9 and 3.10 is still broken
    • Although it wasn't mentioned in your update, it looks like Python 3.8 now works as well in macOS 14 and 15 (not in macOS 13)
    • Python 3.6 and 3.7 still broken everywhere (this one is understandable, as they are EoL)

    The Action run with all the results: https://github.com/carlosperate/pyinstaller-test/actions/runs/12507785149

    Python 3.6 Python 3.7 Python 3.8 Python 3.9 Python 3.10 Python 3.11 Python 3.12 Python 3.13
    macOS 13 ❌ ❌ ❌ ❌ ❌ ✅ ✅ ✅
    macOS 14 ❌ ❌ ✅ ✅ ✅ ✅ ✅ ✅
    macOS 15 ❌ ❌ ✅ ✅ ✅ ✅ ✅ ✅
  12. v-priya-kinthali commented on Jan 10, 2025

    @v-priya-kinthali
    Contributor

    Hello @carlosperate 👋,
    Thank you for the detailed report😊
    The binaries for Python 3.8.18, 3.9.21, and 3.10.16 have been updated in the runner. Could you please rerun your test workflows and let us know if the issue is resolved?
    Your feedback is greatly appreciated!

  13. carlosperate commented on Jan 19, 2025

    @carlosperate

    Thanks @priya-kinthali!

    I've re-run the workflow and 3.8, 3.9 and 3.10 are working 🎉

    The Action run with all the results: https://github.com/carlosperate/pyinstaller-test/actions/runs/12507785149

    Python 3.6 Python 3.7 Python 3.8 Python 3.9 Python 3.10 Python 3.11 Python 3.12 Python 3.13
    macOS 13 ❌ ❌ ✅ ✅ ✅ ✅ ✅ ✅
    macOS 14 ❌ ❌ ✅ ✅ ✅ ✅ ✅ ✅
    macOS 15 ❌ ❌ ✅ ✅ ✅ ✅ ✅ ✅
  14. v-priya-kinthali commented on Jan 22, 2025

    @v-priya-kinthali
    Contributor

    Hello @QuLogic👋,
    Just a gentle reminder to rerun your test workflows with the updated Python binaries to confirm if the issue is resolved. Your feedback would be greatly appreciated!
    Thank you, @carlosperate, for confirming that the issue is resolved for 3.8, 3.9, and 3.10😊

  15. tacaswell commented on Jan 22, 2025

    @tacaswell

    matplotlib/matplotlib#29502 removes our xfail 🤞🏻 it works

  16. tacaswell commented on Jan 22, 2025

    @tacaswell

    Appears to still be broken on osx 13 py3.10 https://github.com/matplotlib/matplotlib/actions/runs/12911339460/job/36003521800?pr=29502#step:14:264

    However I have not checked that we are getting the newest image.

  17. v-priya-kinthali commented on Jan 27, 2025

    @v-priya-kinthali
    Contributor

    Hello @tacaswell👋,
    Upon forking the repository, I noticed that the snippet mentioned in the pull request has multiple occurrences. Could you please check if this could be the reason for the error you are observing?

  18. tacaswell commented on Jan 27, 2025

    @tacaswell

    The code I removed is suppressing the failure in our tests so my error is only reducing the number of failures we see.

    I'll try power-cycling the PR again.

  19. v-priya-kinthali commented on Jan 30, 2025

    @v-priya-kinthali
    Contributor

    Hello @tacaswell 👋,
    When tested on our end, the binaries appear to be functioning as expected. It is possible that the issue may be specific to your setup. To help us better understand and address the issue, could you please provide a minimal repository that reproduces the error you are experiencing? This would greatly assist us in identifying your issue more accurately, given the complexity of the matplotlib repository.
    Thank you!

  20. v-priya-kinthali commented on Feb 10, 2025

    @v-priya-kinthali
    Contributor

    Hello @tacaswell 👋,
    Just a gentle reminder about our previous request for a minimal repository to reproduce the error you are experiencing.
    Thank you!

  21. v-priya-kinthali commented on Feb 17, 2025

    @v-priya-kinthali
    Contributor

    Hello @tacaswell 👋, @QuLogic 👋
    Just giving you a gentle ping to see if there are any updates on your end regarding this issue? Thank you!

  22. v-priya-kinthali commented on Feb 27, 2025

    @v-priya-kinthali
    Contributor

    Hello @QuLogic 👋,
    Since the issue has been resolved and there has been no further activity, we are proceeding with closing this issue due to inactivity. If you encounter any related problems in the future, please feel free to reopen or create a new issue. Thank you!

  23. tacaswell commented on Feb 27, 2025

    @tacaswell
  24. v-priya-kinthali commented on Mar 7, 2025

    @v-priya-kinthali
    Contributor

    Hello @tacaswell👋,
    As mentioned previously, it is quite challenging to determine the exact root cause of the problem without additional details. To assist us in diagnose and resolve the issue more accurately, could you kindly provide a minimal repository that reproduces the error you are experiencing? This would greatly assist us in understanding your specific setup and identifying the issue.

    For troubleshooting, please enable debugging to get more detailed output by setting ACTIONS_STEP_DEBUG to true as detailed here. The logs might provide further insights into the issue you are encountering. Additionally, could you please try to run your Tkinter .py files to check the version and confirm?
    When tested on our end, the workflow ran successfully and the version seems to be correct as seen in the screenshot below:

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions