Repository navigation
Python 3.10.11 macOS: tk.h version (8.5) doesn't match libtk.a version (8.6) #649
Description
Activity
This is a similar issue to #402.
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 🙂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.
Reacted by FMW and turiI'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.whlCurrently 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.whlSome change to Python version, no change to Matplotlib.
And now it's spread to Python 3.9: https://dev.azure.com/matplotlib/matplotlib/_build/results?buildId=34189&view=logs&j=d565cd3d-5b64-5d92-00ca-77c8c01737e7&t=44ca2d65-e117-5342-7366-f7ed442af407&l=416
Is there any progress? It's been 2 months now.
It also seems to be affecting github actions: https://github.com/matplotlib/matplotlib/actions/runs/5326817190/jobs/9649372136?pr=26154#step:13:420
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)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,
pyenvstill somehow picks the header from the system and not for homebrew.Reacted by Iain StensonHas 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,
pyenvstill 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.
21 remaining items
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 ❌ ❌ ✅ ✅ ✅ ✅ ✅ ✅ - 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?)
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!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 ❌ ❌ ✅ ✅ ✅ ✅ ✅ ✅ Reacted by v-priya-kinthaliHello @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😊matplotlib/matplotlib#29502 removes our xfail 🤞🏻 it works
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.
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?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.
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 thematplotlibrepository.
Thank you!Hello @tacaswell 👋,
Just a gentle reminder about our previous request for a minimal repository to reproduce the error you are experiencing.
Thank you!Hello @tacaswell 👋, @QuLogic 👋
Just giving you a gentle ping to see if there are any updates on your end regarding this issue? Thank you!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!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_DEBUGto 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.pyfiles 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:
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:This didn't affect the 3.9 job, which is also using the
20230408.1image.Action version:
0.214.0
Platform:
Runner type:
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: