Skip to content

Python 3.11 + windows-latest → "Tcl wasn't installed properly." randomly happens #1102

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
2 of 5 tasks
34j opened this issue May 11, 2025 · 5 comments
Closed
2 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@34j
Copy link

34j commented May 11, 2025

Description:

The following error sometimes (randomly) occurs (and sometimes does not) when trying to use maplotlib on GitHub Actions with Python 3.11 + windows-latest. Does not happen with Python 3.12, 3.10 and/or Linux, MacOS.

>       self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
E       _tkinter.TclError: Can't find a usable init.tcl in the following directories: 
E           {C:\hostedtoolcache\windows\Python\3.11.9\x64\tcl\tcl8.6}
E       
E       C:/hostedtoolcache/windows/Python/3.11.9/x64/tcl/tcl8.6/init.tcl: couldn't read file "C:/hostedtoolcache/windows/Python/3.11.9/x64/tcl/tcl8.6/init.tcl": No error
E       couldn't read file "C:/hostedtoolcache/windows/Python/3.11.9/x64/tcl/tcl8.6/init.tcl": No error
E           while executing
E       "source C:/hostedtoolcache/windows/Python/3.11.9/x64/tcl/tcl8.6/init.tcl"
E           ("uplevel" body line 1)
E           invoked from within
E       "uplevel #0 [list source $tclfile]"
E       
E       
E       This probably means that Tcl wasn't installed properly.

Action version:
5.6.0

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

3.11

Repro steps:
Same repo status and

Expected behavior:
Always succeed

Actual behavior:
Not always succeed, have to re-run until succeed

@34j 34j added bug Something isn't working needs triage labels May 11, 2025
@aparnajyothi-y
Copy link
Contributor

Hello @34j, Thank you for creating this issue and we will look into it :)

@priya-kinthali priya-kinthali self-assigned this May 13, 2025
@priya-kinthali
Copy link
Contributor

Hello @34j👋,
Thank you for reporting this issue and providing detailed steps to reproduce it.
We have attempted to replicate the error on our end but have not been able to do so. Based on the error logs and the workflow you shared, it appears that the issue is likely not related to the setup-python action or the hosted runner, but may instead originate from upstream dependencies specifically with CPython's handling of virtual environments or the uv environment manager.
The error message 'tkinter.TclError: Can't find a usable init.tcl' suggests that the Tkinter is unable to locate the necessary Tcl/Tk files, which may be related to how uv configures the virtual environment and manages the paths to these resources.

Here are some related discussions for your reference::

  • There is a related issue in CPython (python/cpython#125235), where Tkinter applications fail to start in a virtual  environment. A fix for this issue is included in Python 3.13.1 (python/cpython#125312).
  • The uv repository also has similar discussions regarding environment setup that might be relevant.

Given that the issue appears to be upstream, we recommend reviewing the resources above. If the problem persists, please consider raising the issue in the uv or CPython repositories to receive more targeted assistance.

We hope this helps. Please let us know if you have any further concerns. Thank you!

@priya-kinthali
Copy link
Contributor

Hello @34j👋,
Just giving you a gentle ping to see if you have any further concerns or if you need any additional support from us. Thank you!

@34j
Copy link
Author

34j commented May 28, 2025

I think the first issue you mentioned is unrelated as it is for 3.13. Second one also seems to be unrelated due to different error message.

It seems more like a runner issue as the behavior changes depending on the runner, but as you say it may be related to uv.

@priya-kinthali
Copy link
Contributor

Hello @34j👋,
Thank you for your feedback. To clarify, I referenced the 3.13 issue as it highlights a similar underlying problem with Tkinter and virtual environments on Windows, even though it’s not the exact version you’re experiencing. I also shared the uv repository since it contains related discussions that might be helpful.

As you rightly mentioned, the issue seems to be related to uv or potentially to CPython when used in virtual environments on Windows. We’ve attempted to reproduce the error on our end but were unable to do so. If the problem persists, you might consider reaching out to the uv or CPython repositories for further assistance.

Since this doesn’t appear to be an issue with setup-python, we’ll go ahead and close it for now. If you have any further questions or concerns, please don’t hesitate to reach out. Thank you again for your understanding and patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants