LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Thonny not starting (https://www.linuxquestions.org/questions/slackware-14/thonny-not-starting-4175714063/)

SAJM 06-30-2022 12:06 PM

Thonny not starting
 
I just installed Thonny using sbopkg on my laptop and it will not load.

When I click the Thoony icon on the start menu Thommy appears on the bottom of the screen for a minute then disappears.

The install went ahead with no errors.
I'm running 14.2 and a KDE Desktop.

teckk 06-30-2022 02:32 PM

This?
https://thonny.org/
Quote:

Thonny comes with Python 3.7 built in
Do you have different versions of python on your machine now? Did you have python installed before?

What is the output of
Code:

python
#or
python3

And what error does thonny give if run in terminal.

SAJM 06-30-2022 03:13 PM

Quote:

Originally Posted by teckk (Post 6364708)
This?
https://thonny.org/

Do you have different versions of python on your machine now? Did you have python installed before?

What is the output of
Code:

python
#or
python3

And what error does thonny give if run in terminal.

Here is what I got

Code:

bash-4.3$ python
Python 2.7.17 (default, Oct 20 2019, 14:16:51)
[GCC 5.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> #or
... python3
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
NameError: name 'python3' is not defined
>>>
KeyboardInterrupt
>>>


teckk 06-30-2022 03:30 PM

Ok, you have python2 installed. How about python3? It says that thonny is python3.
What does thonny in the terminal say? Is python3 in your $PATH?

Find out why thonny dies.

SAJM 06-30-2022 05:07 PM

Quote:

Originally Posted by teckk (Post 6364716)
Ok, you have python2 installed. How about python3? It says that thonny is python3.
What does thonny in the terminal say? Is python3 in your $PATH?

Find out why thonny dies.

I installed Python3 and it made no difference

here is my path:
Quote:

bash-4.3$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/kde4/libexec:/usr/lib64/openjdk/bin:/usr/lib64/openjdk/jre/bin:/usr/lib64/qt/bin:/usr/share/texmf/bin
bash-4.3$

SAJM 06-30-2022 05:30 PM

Quote:

Originally Posted by teckk (Post 6364716)
Ok, you have python2 installed. How about python3? It says that thonny is python3.
What does thonny in the terminal say? Is python3 in your $PATH?

Find out why thonny dies.

I installed Python3 and it made no difference

here is my path:
Quote:

bash-4.3$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib64/kde4/libexec:/usr/lib64/openjdk/bin:/usr/lib64/openjdk/jre/bin:/usr/lib64/qt/bin:/usr/share/texmf/bin
bash-4.3$
Quote:

bash-4.3# thonny
ERROR:root:Internal launch or mainloop error
Traceback (most recent call last):
File "/opt/thonny/__init__.py", line 49, in launch
from thonny import workbench
File "/opt/thonny/workbench.py", line 14, in <module>
import tkinter as tk
File "/usr/lib64/python3.7/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'
Traceback (most recent call last):
File "/opt/thonny/__init__.py", line 49, in launch
from thonny import workbench
File "/opt/thonny/workbench.py", line 14, in <module>
import tkinter as tk
File "/usr/lib64/python3.7/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'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/thonny/__main__.py", line 18, in <module>
launch()
File "/opt/thonny/__init__.py", line 83, in launch
from thonny import ui_utils
File "/opt/thonny/ui_utils.py", line 13, in <module>
import tkinter as tk
File "/usr/lib64/python3.7/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'
bash-4.3#

SAJM 06-30-2022 10:54 PM

python3 seemed to install OK with no errors however it clearly has not installed.
What would stop it being installed yet bring up no errors?

Quote:

bash-4.3$ python
Python 2.7.17 (default, Oct 20 2019, 14:16:51)
[GCC 5.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> #or
... python3
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
NameError: name 'python3' is not defined
>>>
and

Quote:

bash-4.3# slackpkg search python

Looking for python in package list. Please wait... DONE

The list below shows all packages with name matching "python".

[ installed ] - python-2.7.17-x86_64-1_slack14.2
[ installed ] - python-setuptools-22.0.5-x86_64-1
[ installed ] - kdev-python-1.7.2-x86_64-1
[ installed ] - dbus-python-1.2.4-x86_64-1
[ installed ] - notify-python-0.1.1-x86_64-5
[ installed ] - python-pillow-3.0.0-x86_64-1

You can search specific files using "slackpkg file-search file".


bash-4.3#

SAJM 06-30-2022 11:03 PM

....however if I ls packages, python3-3.7.2-x86_64-1_SBo is listed.

pan64 06-30-2022 11:31 PM

you need to start python3 with the command python3 (instead of python, which defaults to python2).
I don't really know how did you try to start thonny, but probably
Code:

pip3 install thonny
thonny

or something similar will work. But probably you need to install tkinter (python3-tk) too.

SAJM 07-01-2022 12:32 AM

Interesting that Tkinter is not included in sbopkg or slackpkg - is that telling me something?

SAJM 07-01-2022 05:03 AM

Code:

pip3 install thonny
thonny

result

Code:

bash-4.3# pip3 install thonny > thonny.txt
You are using pip version 18.1, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
bash-4.3# thonny
INFO    thonny: Thonny version: 3.3.14
Traceback (most recent call last):
  File "/usr/bin/thonny", line 11, in <module>
    sys.exit(launch())
  File "/usr/lib64/python3.7/site-packages/thonny/__init__.py", line 178, in launch
    if not _check_welcome():
  File "/usr/lib64/python3.7/site-packages/thonny/__init__.py", line 146, in _check_welcome
    from thonny.config import ConfigurationManager
  File "/usr/lib64/python3.7/site-packages/thonny/config.py", line 9, in <module>
    import tkinter as tk
  File "/usr/lib64/python3.7/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'
bash-4.3#


SAJM 07-01-2022 06:05 AM

I dont get it
On KDE nothing loads
No Python2, no Python3 and no Thonny

On the treminal both Python 2 & 3 open

Thonny does not.

I wish I knew what this means:
Quote:

bash-4.3# thonny
INFO thonny: Thonny version: 3.3.14
Traceback (most recent call last):
File "/usr/bin/thonny", line 11, in <module>
sys.exit(launch())
File "/usr/lib64/python3.7/site-packages/thonny/__init__.py", line 178, in launch
if not _check_welcome():
File "/usr/lib64/python3.7/site-packages/thonny/__init__.py", line 146, in _check_welcome
from thonny.config import ConfigurationManager
File "/usr/lib64/python3.7/site-packages/thonny/config.py", line 9, in <module>
import tkinter as tk
File "/usr/lib64/python3.7/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'
bash-4.3#

teckk 07-01-2022 08:16 AM

Quote:

ModuleNotFoundError: No module named '_tkinter'
You probably don't have tk/tcl installed. tkinter uses that.

Start with some basics.

In a terminal, can you open a python3 shell. You already established that you have python2 working.(post3-7)

Find out where python3 is. And if your shell have a PATH to the executable. Looks like it does.

Example: (arch)
Code:

python
Python 3.10.5 (main, Jun  6 2022, 18:49:26) [GCC 12.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Code:

which python
/usr/bin/python

Until you have a working python3, nothing will work.

Then in the working python3 shell
Code:

python
Python 3.10.5 (main, Jun  6 2022, 18:49:26) [GCC 12.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>

If you get an error, you'll need to fix it. What is the error to that?

In python2 it was Tkinter, in python3 it is tkinter.

Edit:
You need to troubleshoot this a step at a time.

BrunoLafleur 07-01-2022 08:17 AM

Quote:

Originally Posted by SAJM (Post 6364846)
I dont get it
On KDE nothing loads
No Python2, no Python3 and no Thonny

On the treminal both Python 2 & 3 open

Thonny does not.

I wish I knew what this means:

It means that the python3 interface for TK is missing.

Maybe python3 was compiled without TK support.

So it seems it could be installed with :

> pip3 install tk

teckk 07-01-2022 08:26 AM

Here is the source. Which is where you would first look, if you are trying to build something.
https://github.com/thonny/thonny

Look at the error in post #12
Code:

File "/usr/lib64/python3.7/site-packages/thonny/config.py", line 9, in <module>
import tkinter as tk

File "/usr/lib64/python3.7/tkinter/__init__.py", line 36, in <module>

File "/usr/lib64/python3.7/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'

That would be here
https://github.com/thonny/thonny/blo...onny/config.py

And here
https://github.com/thonny/thonny/blo...ny/__init__.py

You don't have tkinter working. Start with fixing that. Show what eroors you are getting step by step. Or you will never get anywhere.


All times are GMT -5. The time now is 08:50 PM.