0

I am new. Please bear with... I use a Chromebook with Python 3.9.7 and PyCharm on the Linux Beta. Has been working fine for weeks. For a course I have been asked to use Turtle. PyCharm kicks out an error message:

Traceback (most recent call last): File "/home/jimmygill27/PycharmProjects/day-16-start/main.py", line 6, in from turtle import Turtle File "/usr/lib/python3.9/turtle.py", line 107, in import tkinter as TK ModuleNotFoundError: No module named 'tkinter'

What are the linux commands to get this module? I cannot find any specific reference to this problem?

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
JimmyG27
  • 1
  • 1
  • 1
    Does `sudo apt-get install python3-tk` work? – pxDav Sep 23 '21 at 00:33
  • Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: tried that and received the following error message: The following packages have unmet dependencies: python3-tk : Depends: python3 (< 3.8) but 3.9.2-3 is to be installed E: Unable to correct problems, you have held broken packages. – JimmyG27 Sep 23 '21 at 00:40
  • this was the error message received – JimmyG27 Sep 23 '21 at 00:41
  • just doublechecked the version and it is Python 3.9.7 (default, Sep 3 2021, 06:18:44) [GCC 10.3.0] on linux – JimmyG27 Sep 23 '21 at 00:42
  • 1
    Can you fix it using `sudo apt -f install`? – pxDav Sep 23 '21 at 00:53
  • the response to that command was as follows: 0 upgraded, 0 newly installed, 0 to remove and 71 not upgraded. – JimmyG27 Sep 23 '21 at 02:19
  • Should I reinstall python - appears from the error messages that someting is missing. For reference this is the link I found and followed to install python. (The Udemy Course I am on only had instruction for windows/mac) https://www.linuxmadesimple.info/2021/01/how-to-install-python-39-on-chromebook.html – JimmyG27 Sep 23 '21 at 02:25
  • Correct me if I am wrong but I am guessing that this command (command 4 in the instructions that I followed) does not have everything I need (e.g.turtle): sudo apt install python3 python3-pip build-essential libssl-dev libffi-dev python3-dev -y – JimmyG27 Sep 23 '21 at 02:43
  • Does this answer your question? [Why does tkinter seem to be missing or broken? Shouldn't it be part of the standard library?](https://stackoverflow.com/questions/76105218/why-does-tkinter-seem-to-be-missing-or-broken-shouldnt-it-be-part-of-the-stand) – Karl Knechtel Apr 25 '23 at 20:56

1 Answers1

0

I was having the same issue - installed PyCharm on a Chromebook but Tkinter was missing when I tried some test code with the turtle module.

The command sudo apt install python3-tk resolved my issue.

Thanks to @PyxlDavon!

Matthew
  • 21
  • 4