Skip to content
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

tkinter is missing init.tcl in poetry's virtualenv #9892

Open
alexchandel opened this issue Dec 6, 2024 · 1 comment
Open

tkinter is missing init.tcl in poetry's virtualenv #9892

alexchandel opened this issue Dec 6, 2024 · 1 comment
Labels
kind/bug Something isn't working as expected status/external-issue Issue is caused by external project (platform, dep, etc)

Comments

@alexchandel
Copy link

Description

tkinter requires some subfolders from the tcl folder of the CPython installation. However poetry does not copy these in, and poetry does not allow post-install scripts, meaning there is no simple way to automate this at installation.

Workarounds

Manually copy tcl8.6 and tk8.6 into the venv's Lib folder.

Poetry Installation Method

pipx

Operating System

Windows 11

Poetry Version

1.8.4

Poetry Configuration

poetry config --list
cache-dir = "C:\\Users\\me\\AppData\\Local\\pypoetry\\Cache"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\me\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true


### Python Sysconfig

```bash session
python -m sysconfig
Platform: "win-amd64"
Python version: "3.13"
Current installation scheme: "nt"

Paths:
        data = "C:\Program Files\Python313"
        include = "C:\Program Files\Python313\Include"
        platinclude = "C:\Program Files\Python313\Include"
        platlib = "C:\Program Files\Python313\Lib\site-packages"
        platstdlib = "C:\Program Files\Python313\Lib"
        purelib = "C:\Program Files\Python313\Lib\site-packages"
        scripts = "C:\Program Files\Python313\Scripts"
        stdlib = "C:\Program Files\Python313\Lib"

Variables:
        BINDIR = "C:\Program Files\Python313"
        BINLIBDEST = "C:\Program Files\Python313\Lib"
        EXE = ".exe"
        EXT_SUFFIX = ".cp313-win_amd64.pyd"
        INCLUDEPY = "C:\Program Files\Python313\Include"
        LDLIBRARY = "python313.dll"
        LIBDEST = "C:\Program Files\Python313\Lib"
        LIBDIR = "C:\Program Files\Python313\libs"
        LIBRARY = "python313.dll"
        Py_GIL_DISABLED = "0"
        SOABI = "cp313-win_amd64"
        TZPATH = ""
        VERSION = "313"
        VPATH = "..\.."
        abi_thread = ""
        abiflags = ""
        base = "C:\Program Files\Python313"
        exec_prefix = "C:\Program Files\Python313"
        implementation = "Python"
        implementation_lower = "python"
        installed_base = "C:\Program Files\Python313"
        installed_platbase = "C:\Program Files\Python313"
        platbase = "C:\Program Files\Python313"
        platlibdir = "DLLs"
        prefix = "C:\Program Files\Python313"
        projectbase = "C:\Program Files\Python313"
        py_version = "3.13.0"
        py_version_nodot = "313"
        py_version_nodot_plat = "313"
        py_version_short = "3.13"
        srcdir = "C:\Program Files\Python313"
        userbase = "C:\Users\me\AppData\Roaming\Python"


### Example pyproject.toml

```TOML
Any vanilla script that uses `tkinter`:


poetry run vpcp.py
Traceback (most recent call last):
  File "C:\Projects\vpcp\vpcp.py", line 2758, in <module>
    main()
    ~~~~^^
  File "C:\Projects\vpcp\vpcp.py", line 2737, in main
    root = tk.Tk()
  File "C:\Program Files\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:/Program Files/Python313/lib/tcl8.6} C:/Users/me/AppData/Local/pypoetry/Cache/virtualenvs/vpcp-hmXVBWTb-py3.13/lib/tcl8.6 C:/Users/me/AppData/Local/pypoetry/Cache/virtualenvs/lib/tcl8.6 C:/Users/me/AppData/Local/pypoetry/Cache/virtualenvs/vpcp-hmXVBWTb-py3.13/library C:/Users/me/AppData/Local/pypoetry/Cache/virtualenvs/library C:/Users/me/AppData/Local/pypoetry/Cache/virtualenvs/tcl8.6.14/library C:/Users/me/AppData/Local/pypoetry/Cache/tcl8.6.14/library



This probably means that Tcl wasn't installed properly.


### Poetry Runtime Logs

```bash session
N/A
@alexchandel alexchandel added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Dec 6, 2024
@dimbleby
Copy link
Contributor

dimbleby commented Dec 6, 2024

Poetry uses virtualenv, you will want to take this to that project

@Secrus Secrus added status/external-issue Issue is caused by external project (platform, dep, etc) and removed status/triage This issue needs to be triaged labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/external-issue Issue is caused by external project (platform, dep, etc)
Projects
None yet
Development

No branches or pull requests

3 participants