r/learnpython • • Sep 04 '26

my pycharm hate turtle

im using linux mint and when i try to import turtle it always says
"

import turtle

ModuleNotFoundError: No module named 'turtle'

Process finished with exit code 1

"
i tryed to download tinker it dont help me i dont know what to do no one have that problem

1 Upvotes

1 comment sorted by

1

u/Bright_Mix_773 Sep 06 '26

On Mint, turtle is not part of the base Python package. Debian and Ubuntu split the standard library into several deb packages, and turtle.py ships inside python3-tk together with tkinter. That is why the message names turtle and not _tkinter: the file genuinely is not on disk.

sudo apt install python3-tk

Then check it landed:

python3 -c "import turtle; print(turtle.__file__)"

You said you already tried installing tkinter and it did not help, so the next thing to pin down is which Python PyCharm is running, because apt only fixes /usr/bin/python3. Run these two lines inside PyCharm, in the same file that gives you the error:

import sys
print(sys.executable)
  • If it prints /usr/bin/python3, or a path ending in .venv/bin/python for a venv you created from the system Python, then apt install python3-tk is enough and you do not need to recreate the venv. A venv borrows the standard library from the Python it was built from, so the new file shows up immediately.
  • If it prints something under ~/.pyenv, /snap, or a Python you compiled yourself, apt will not touch it. Those builds only get turtle if tk-dev was present when they were built, so it means rebuilding or reinstalling that interpreter. The quickest way out is to point PyCharm at /usr/bin/python3 instead: Settings, Project, Python Interpreter, Add Interpreter, System Interpreter.

One thing to watch for after the apt install: if the error changes to ModuleNotFoundError: No module named '_tkinter', that is a different problem and it confirms the second case. It means turtle.py is now there but the interpreter has no Tk bindings compiled into it.

I run Debian and Ubuntu rather than Mint, so I have not tested this on Mint itself, but the packaging is the same underneath.