Skip to content

python is not configured for tkinter #122

@jstewmon

Description

@jstewmon

Is tkinter purposefully omitted? It seems like the only way to enable it is to rebuild from source.

Adding apt-get update && apt-get install -y --no-install-recommends tk-dev && rm -r /var/lib/apt/lists/* to the current Dockerfiles appears to resolve the issue, but adds ~20MB to the resulting image.

Current behavior:

$ docker run --rm -it python:3.5 python -m tkinter
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/runpy.py", line 174, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/lib/python3.5/runpy.py", line 133, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/local/lib/python3.5/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/local/lib/python3.5/tkinter/__init__.py", line 35, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named '_tkinter'

$ docker run --rm -it python:2.7 python -m Tkinter
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions