0

PyCharm does not see the turtle standard library - a turtle for learning python. (OS Linux Mint)

On another computer (Ubuntu/PyCharm) the code works without errors. On the same run in Spyder and through the terminal: python3 1.py - works. It is PyCharm, installed from the application manager, that is broken.

If you remove PyCharm installed from the application manager and install from the JetBrains website, then the code also works.

I also noticed that PyCharm with JetBrains works with python3.5 (as in the system), and PyCharm from the application manager with python3.9.

What tried:

  • select a system interpreter: /usr/bin/python3 (for some reason, the 3.9 version also appears at the specified address)
  • reinstall PyCharm from application manager
  • reset File > Manage IDE Settings > Restore Default Settings

Nothing helps

import turtle
 
turtle.shape('turtle')
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.left(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(50)

Please help me figure out what is the reason for such capricious behavior of PyCharm

`/usr/bin/python3.9 /home/max/PycharmProjects/tttttttt/1.py Traceback (most recent call last): File "/home/max/PycharmProjects/tttttttt/1.py", line 1, in <module> import turtle ModuleNotFoundError: No module named 'turtle'

Process finished with exit code 1`

luck-code
  • 1
  • 2
  • Are you using the flatpack version of Pycharm ? – Cubix48 Mar 27 '22 at 09:37
  • i dont know what is flatpack version. I installed it from manager of programms linux mint – luck-code Mar 27 '22 at 09:53
  • Pycharm's flatpack installation is known to have many issues, such as this one. I really advise you to uninstall it and install from [Jetbrains site](https://www.jetbrains.com/pycharm/download/#section=linux) instead. You can also install [Toolbox](https://www.jetbrains.com/toolbox-app/) instead, so you don't have any problems with updates. – Cubix48 Mar 27 '22 at 10:08
  • Flatpack vinstallation is it, what i installed from program manager in linux mint? I don't like PyCharm from JetBrains-site, becouse it is not installation version. It is portable. How i can to install PyCharm in my system? – luck-code Mar 27 '22 at 13:01
  • You downloaded a Flatpack version. What about using `snap` then ? I still recommend you to use the version available on the Jetbrains site, it's not a portable version. – Cubix48 Mar 27 '22 at 13:29
  • ok, i understood. PyCharm from program manager linux mint - it is flatpack version. But snap what is it? Ok, i'll intall PyCharm from JetBrains – luck-code Mar 27 '22 at 23:11

1 Answers1

0

do pip list or pip freeze and check all the installed packages and is turtle installed in current environment or not I would suggest to use venvs for projects your are trying to work with

  1. python3 -m venv venv
  2. source venv/bin/activate
  3. pip3 install turtle

Do this in your terminal. In case if you currently have some venv installed try to activate it with option 2. of the answer

Izuki13
  • 54
  • 6
  • I wrote `python3 -m venv venv` NEXT `source venv/bin/activate` NEXT `python 1.py` works in terminal, module found. I didn't even `pip3 install turtle` But, when I opened PyCharm, opened the project, selected the `/venv/bin/python3` interpreter - it didn't work. ModuleNotFoundError: No module named 'turtle' – luck-code Mar 27 '22 at 12:27
  • could you try `pip freeze` in pycharm terminal, when venv is activated? – Izuki13 Mar 27 '22 at 16:16
  • Also you can try `ctrl+shift+s` in pycharm and choose Python Interpreter, there, it will give you the list of installed packages for current project's interpreter – Izuki13 Mar 27 '22 at 16:17