Skip to content

Python 3.14.7 tkinter fails when per-user installation path contains a space #158178

Open

Description

@saedkh-cell

Bug report

Bug description:

Bug description

On Windows 10, tkinter cannot initialize when the official Python 3.14.7
installation is located under a user-profile path containing a space.

Python was installed using the official 64-bit installer with the default
per-user installation options. The issue persisted after completely
uninstalling and reinstalling Python.

The Tcl/Tk archives are present:

  • tcl\libtcl9.0.4.zip
  • tcl\libtk9.0.4.zip

Running the installation normally fails:

$python = "$env:LOCALAPPDATA\Programs\Python\Python314\python.exe"
& $python -m tkinter

The result is:

_tkinter.TclError: Cannot find a usable init.tcl in the following directories:
    <redacted user profile>/AppData/Local/Programs/Python/Python314/lib/tcl9.0
    ...
This probably means that Tcl wasn't installed properly.

However, mapping the exact same Python installation to a drive letter makes
Tkinter work immediately:

subst T: "$env:LOCALAPPDATA\Programs\Python\Python314"
T:\python.exe -m tkinter
subst T: /d

The Tk demonstration window opens successfully through T:\python.exe.

No Python or Tcl/Tk files are copied or changed between the two tests. The only
difference is whether the same installation is accessed through its original
path, which contains a space, or through a drive-letter path without spaces.

A minimal program produces the same result:

import tkinter as tk

root = tk.Tk()
root.destroy()

Expected behavior

tkinter should initialize from the default per-user installation location
even when the Windows account/profile name contains a space.

Actual behavior

tkinter reports that it cannot find a usable init.tcl. Accessing the same
installation through a drive-letter mapping without spaces resolves the
failure.

Reproduction steps

  1. Use a Windows account whose user-profile directory contains a space.

  2. Install official Python 3.14.7 64-bit using the default per-user options.

  3. Run:

    & "$env:LOCALAPPDATA\Programs\Python\Python314\python.exe" -m tkinter
  4. Observe the Cannot find a usable init.tcl error.

  5. Run:

    subst T: "$env:LOCALAPPDATA\Programs\Python\Python314"
    T:\python.exe -m tkinter
    subst T: /d
  6. Observe that Tkinter now starts successfully.

Python version

Python 3.14.7
tags/v3.14.7:823f032
MSC v.1944 64 bit (AMD64)

Operating system

Windows 10 10.0.19045
64-bit

Additional checks

The installed archives exist and are not empty:

libtcl9.0.4.zip    1,121,107 bytes
libtk9.0.4.zip       297,208 bytes

The problem remained after:

  • Uninstalling Python 3.14.7
  • Reinstalling it with the official installer
  • Using the default installation options
  • Confirming that the Tcl/Tk component is registered as installed

This appears related to Tcl/Tk 9 ZIP-library discovery or mounting when the
Python installation path contains a space.

Related issues checked

CPython versions tested on:

3.14

Operating systems tested on:

Windows

Activity

  1. im-alok74 commented on Sep 27, 2026

    @im-alok74

    Hi! I'd like to work on this issue and investigate the Tcl/Tk path-handling problem on Windows, particularly how spaces in the per-user installation path affect ZIP-library discovery.

    I can reproduce the issue, investigate the underlying cause, and work on a fix with appropriate tests.

    Could you please assign this issue to me? I'd be happy to submit a PR following the project's contribution guidelines.

    Thanks!

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Sep 27, 2026
  3. picnixz commented on Sep 27, 2026

    @picnixz
    Member

    Does it happen with Python 3.14.6? we updated tkinter to version 9.x on Windows IIRC so it might also be a tkinter issue itself.

  4. picnixz commented on Sep 27, 2026

    @picnixz
    Member

    And does it happen on Linux as well or other platforms?

  5. saedkh-cell commented on Sep 28, 2026

    @saedkh-cell
    Author

    @picnixz Thank you for looking into this.

    So far, I have reproduced the issue only with the official 64-bit Python
    3.14.7 installer on Windows 10. I have not tested Python 3.14.6 or
    Linux/other platforms.

    The failure appears tied to the Windows per-user installation path containing
    a space. The same Python 3.14.7 installation fails from its normal path but
    works immediately when accessed through a subst drive path without spaces.

    I can test Python 3.14.6 on the same Windows machine if that would be useful.

  6. saedkh-cell commented on Sep 28, 2026

    @saedkh-cell
    Author

    @picnixz I tested Python 3.14.6 on the same Windows 10 machine.

    I assembled an isolated 64-bit Python 3.14.6 runtime from the official
    core.msi, exe.msi, lib.msi, and tcltk.msi packages. The temporary
    runtime path contained spaces.

    Running Tkinter directly from that path failed:

    _tkinter.TclError: Can't find a usable init.tcl
    

    Python 3.14.6 reported Tcl/Tk 8.6, and its Tcl library was present under the
    runtime's tcl\tcl8.6 directory.

    Mapping the identical runtime to T: and running the same minimal test
    succeeded:

    SUCCESS Tcl/Tk 8.6 8.6
    

    Therefore, Python 3.14.6 is affected as well. This also shows that the problem
    is not specific to Python 3.14.7's Tcl/Tk 9 ZIP packaging; the common factor is
    a space in the Python runtime path.

    I have not tested Linux or other platforms. The current reproduction is
    Windows-specific.

  7. terryjreedy commented on Sep 28, 2026

    @terryjreedy
    Member

    Saed, we don't much assign issues in the sense I think you mean. If the solution to an issue is obvious, we may give a person a week to make a PR. In any case, our principle tkinter maintainer may take a few days or more to look at this. If you find a cause, either post it or a PR and he will eventually review it.

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

    OS-windowsstdlibStandard Library Python modules in the Lib/ directorytopic-tkintertype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions