Skip to content

Tkinter does not run in 3.13.0 #125179

Closed as not planned
Closed as not planned

Description

@litiegang1989

Bug report

Bug description:

I can not use Tkinter in the version of 3.13.0, even if I just import tkinter will have a wrong. I try to run the program on two different laptops, and have the same problem.

from tkinter import *

Process finished with exit code -1073741819 (0xC0000005)


### CPython versions tested on:

3.13

### Operating systems tested on:

Windows

Activity

  1. terryjreedy commented on Oct 9, 2024

    @terryjreedy
    Member

    Works fine for me when installed with the new python.org installer.

    C:\Users\Terry>py
    Python 3.13.0 (tags/v3.13.0:60403a5, Oct  7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from tkinter import *
    >>> dir()
    ['ACTIVE', 'ALL', 'ANCHOR', 'ARC', 'BASELINE', 'BEVEL', 'BOTH', 'BOTTOM', 'BROWSE', 'BUTT', 'BaseWidget', 'BitmapImage', 'BooleanVar', 'Button', 'CASCADE', 'CENTER', 'CHAR', 'CHECKBUTTON', 'CHORD', 'COMMAND', 'CURRENT', 'CallWrapper', 
    <...>
    'image_names', 'image_types', 'mainloop']
    >>>
    

    Please give exact details of how you got your python binary and exact how you ran it.

    Note: the triple backticks should enclose code and output but not the template headings and responses.

  2. added
    pendingThe issue will be closed if no feedback is provided
    on Oct 9, 2024
  3. changed the title [-]Tkinter can not use in the version of 3.13.0[/-] [+]Tkinter does not run in 3.13.0[/+] on Oct 9, 2024
  4. colesbury commented on Oct 9, 2024

    @colesbury
    Contributor

    Did you install the free-threaded binaries? Tkinter is broken on free-threaded Windows 3.13t: #118973

  5. terryjreedy commented on Oct 9, 2024

    @terryjreedy
    Member

    I have been running IDLE on locally built free-threading builds since March 15 this year, so this is a packaging issue.

    Python 3.14.0a0 experimental free-threading build (heads/main:440632adb29, Oct  9 2024, 10:25:28) [MSC v.1941 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tkinter
    >>> dir()
    ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'tkinter']
    
  6. joshburnett commented on Oct 9, 2024

    @joshburnett

    I see this issue when running Python from within a venv:

    Python 3.13.0 (tags/v3.13.0:60403a5, Oct  7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tkinter
    >>> root = tkinter.Tk()
    Traceback (most recent call last):
      File "<python-input-2>", line 1, in <module>
        root = tkinter.Tk()
      File "C:\Users\jburnett1\AppData\Local\Programs\Python\Python313\Lib\tkinter\__init__.py", line 2459, in __init__
        self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
                  ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    _tkinter.TclError: Can't find a usable init.tcl in the following directories:
        C:/Users/MY_USER_NAME/AppData/Local/Programs/Python/Python313/lib/tcl8.6 C:/Users/jburnett1/AppData/Local/Programs/Python/lib/tcl8.6 C:/Users/MY_USER_NAMEAppData/Local/Programs/lib/tcl8.6 C:/Users/MY_USER_NAME/AppData/Local/Programs/Python/library C:/Users/MY_USER_NAME/AppData/Local/Programs/library C:/Users/MY_USER_NAME/AppData/Local/Programs/tcl8.6.14/library C:/Users/MY_USER_NAME/AppData/Local/tcl8.6.14/library
    

    Running in the base Python install works OK. I'm not running the free-threaded build.

    I'm testing on Windows 11, though I've seen a report of this on Windows 10 as well.

    Also worth noting that I ran into this issue with the binary from the python.org installer as well as installing Python via UV.

    My python.org-installed version is installed for just my user, and I do see the above-mentioned init.tcl file in C:\Users\MY_USER_NAME\AppData\Local\Programs\Python\Python313\tcl\tcl8.6 but this directory is not listed in the traceback as one of the ones being searched.

  7. litiegang1989 commented on Oct 10, 2024

    @litiegang1989
    Author

    20241010-071407
    I download the installer from the official site.I test again on Windows 11, If I install with the option clicked, it will have this problem. If I install without download free-threaded binaries, tkinter can run normally.

  8. terryjreedy commented on Oct 10, 2024

    @terryjreedy
    Member

    @joshburnett Please open a separate issue for failures, if any, that only occur with venv. Reference threads on discuss.python.org if this is claimed.

    EDIT: Robin Becker opened #125235. Fix in 3.13.1.

  9. removed
    pendingThe issue will be closed if no feedback is provided
    on Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixestopic-tkintertype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions