Bug 255602 - lang/python38: 'import turtle' fails: ModuleNotFoundError: No module named '_tkinter'
Summary: lang/python38: 'import turtle' fails: ModuleNotFoundError: No module named '_...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-python (Nobody)
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2021-05-05 00:17 UTC by Yuri Victorovich
Modified: 2021-05-06 01:20 UTC (History)
0 users

See Also:
koobs: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2021-05-05 00:17:47 UTC
> $ python3.8
> Python 3.8.8 (default, Feb 25 2021, 10:57:58) 
> [Clang 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611a on freebsd12
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import turtle
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python3.8/turtle.py", line 107, in <module>
>     import tkinter as TK
>   File "/usr/local/lib/python3.8/tkinter/__init__.py", line 36, in <module>
>     import _tkinter # If this fails your Python may not be configured for Tk
> ModuleNotFoundError: No module named '_tkinter'
> >>> 

FreeBSD 12.2
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2021-05-05 02:44:33 UTC
turle has existed and required tkinter to work pretty much forever. Some potential courses of action, or variations thereof:

 - Unconditionally depend on x11-toolkits/py-tkinter *and* anything else installed by the stdlib that depends on external libraries (like sqlite doesn't work without databases/py-sqlite3), because turtle is not a unique case.

 - Add OPTIONS for all external library dependencies (this is technically an incomplete solution if it doesn't also remove modules when the options are disabled)

 - Don't install any module which has a third party dependency in lang/python* ports, and install/package them with the respective sub-packaged port

 - WONTFIX (asking if the error message is enough for users to grok what to do)

 - Stop sub-packaging

 - ...
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2021-05-05 02:52:20 UTC
(In reply to Kubilay Kocak from comment #1)

IMO (3) is what should be done: turtle should be a separate port.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-05-06 01:12:08 UTC
(In reply to Yuri Victorovich from comment #2)

I haven't thought much about the implications between the options yet, but if we do go that route, we should do it with, and for, other modules that require external dependencies or that don't work unless other sub-ports/packages are installed. At this stage there's no additional or different impact for turtle than with other modules with the same issue (sqlite3, etc)
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2021-05-06 01:16:28 UTC
(In reply to Kubilay Kocak from comment #3)

I agree.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2021-05-06 01:20:27 UTC
(In reply to Yuri Victorovich from comment #4)

Awesome. Let's leave this here as a medium-term reminder. We (python + interested parties) should think critically about the implications of the options (or others), and come up with a reasoned decision.