python3 contains turtle.py without python3-tk installed

Bug #2093393 reported by Tan Chenyu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python3.13 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

When I using python3 without installing python3-tk,
the "import turtle" command returns "No module named 'tkinter'" instead of "No module named 'turtle'".

Here is a transcript:
$ python3
Python 3.11.2 (main, Sep 14 2024, 03:00:30) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import turtle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/turtle.py", line 107, in <module>
    import tkinter as TK
ModuleNotFoundError: No module named 'tkinter'

I suggest that the turtle.py be put into python3-tk, not python3.
It is recommended that python3.13 be modified first.
There is the same issue on Debian, but I always failed to sent email :(
The familiar issue on Windows has been fixed: https://github.com/python/cpython/pull/126176

Revision history for this message
Stefano Rivera (stefanor) wrote :

I swear I've seen this bug filed somewhere else before, but I can't find it.

The turtle module would not be a good fit in python3-tk. The rigth thing to do here is to just emit a more helpful error message.

affects: python3-defaults (Ubuntu) → python3.13 (Ubuntu)
Revision history for this message
Tan Chenyu (ubuntu-tcy-deactivatedaccount) wrote :

Well, I checked deb file. Though it is not fit with python3-tk, it should fit with python3.13-tk.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python3.13 - 3.13.2-1

---------------
python3.13 (3.13.2-1) unstable; urgency=medium

  * Python 3.13.2.
  * Refresh patches.
  * Raise a more helpful ImportError in the turtle module. LP: #2093393.
  * Replace locale-module.patch with something to the change that landed
    upstream, and just missed 3.13.2.
  * Patch: update manpage, it has been neglected for a few releases.
    Closes: #1095052
  * Update symbols.

 -- Stefano Rivera <email address hidden> Tue, 04 Feb 2025 21:23:35 -0400

Changed in python3.13 (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.