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.

FlinchX 07-01-2022 01:23 PM

Quote:

Originally Posted by SAJM
I just installed Thonny using sbopkg on my laptop and it will not load.

Quote:

Originally Posted by SAJM
I'm running 14.2 and a KDE Desktop.

How exactly did you install it? Please describe the exact sequence of actions that you performed. Did you just start sbopkg, searched for "thonny", then installed it? If so, it's very likely that it's the wrong way to do it, in either 14.2 or 15.0. If you go to the corresponding page on SBo http://slackbuilds.org/repository/14.2/python/thonny/ you will see that it has build dependencies. Hence, you need to generate the queue file for it:

Code:

# sqg -p thonny
Then start sbopkg, load the queue for thonny and install all the packages, as in both thonny and its dependencies.

Quote:

Originally Posted by SAJM
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
>>>


:( This proves that you just blindly copypasted the whole without thinking. You were supposed to do

Code:


bash-4.3$ python3

after you did

Code:


bash-4.3$ python

First would check the default python version, second would explicitly check if you have python3

Quote:

Originally Posted by SAJM
I installed Python3

Again, no details about how exactly did you install Python3. And this probably implies that you did not have it already installed for something else before thonny. Then that probably you didn't go through the queue file workflow mentioned above, otherwise python3 would've been installed when you ran the queue for thonny in sbopkg.

Quote:

Originally Posted by pan64
I don't really know how did you try to start thonny, but probably
Code:

pip3 install thonny
thonny

or something similar will work.

IMHO suggesting to install software provided by SBo via pip to somebody who's not very experienced (see my copypaste comment above) will only add more confusion. Your example command will work as root, mixing stuff installed for python3 via sbopkg from SBo and software for the same python3 installed directly via pip, which is a VERY bad thing. It's possible to install things via pip as regular user, but then the pip command requires an additional --user command line argument. Yet I'm not sure using pip is needed, as I said above.

Quote:

Originally Posted by pan64
But probably you need to install tkinter (python3-tk) too.

Oh please, this is Slackware, not Debian. It doesn't split python into multiple packages, adding even more confusion. If python3 was installed correctly, via the SBo script for 14.2, it contains tk, just like the vanilla python2 package. Lack of tk in python3 means that probably python3 was installed differently, hence I asked OP above to provide more details.

Quote:

Originally Posted by BrunoLafleur
Maybe python3 was compiled without TK support.

So it seems it could be installed with :

> pip3 install tk

Please, stop suggesting pip in this context. Slackware 14.2 was the stable version for many years. You don't imagine SBo shipped python3 with no tk, considering that vanilla python2 in Slackware doesn't split the python package? See above.

SAJM 07-01-2022 02:17 PM

How do I configure python for Tk?

As per the final error in #12 above.

I'm guessing that the standard Python install does not use Tk. Tk is something unique to Thonny

SAJM 07-01-2022 03:00 PM

Quote:

Originally Posted by FlinchX (Post 6364942)
Did you just start sbopkg, searched for "thonny", then installed it?

That's exactly what I did. It seemed logical and has worked in the past.
I always understood the dependencies were all installed as a package when using sbopkg

teckk 07-01-2022 03:10 PM

Open a python3 shell, and see if you can import tkinter. If not what is the error.

Or just keep ignoring the advise you are given.

Edit:
https://docs.python.org/3/index.html
https://docs.python.org/3/library/tkinter.html

SAJM 07-01-2022 03:12 PM

I removed Python3 and reinstalled it paying particular attention to the output. It was very fast but I did see mention of tk flash past but it still was not installed

teckk 07-01-2022 03:20 PM

You are new to python. You are going to have an impossible time, unless you start at step one, then 2...

Arch calls python3 python, Slack might call that python3. It's your box, find out.

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
>>> help(tkinter)
...

Help on package tkinter:

NAME
    tkinter - Wrapper functions for Tcl/Tk.

MODULE REFERENCE
    https://docs.python.org/3.10/library/tkinter.html
   
    The following documentation is automatically generated from the Python
    source files.  It may be incomplete, incorrect or include features that
    are considered implementation detail and may vary between Python
    implementations.  When in doubt, consult the module reference at the
    location listed above.

DESCRIPTION
    Tkinter provides classes which allow the display, positioning and
    control of widgets. Toplevel widgets are Tk and Toplevel. Other
    widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
    Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox
    LabelFrame and PanedWindow.
   
    Properties of the widgets are specified with keyword arguments.
    Keyword arguments have the same name as the corresponding resource


SAJM 07-01-2022 03:30 PM

Quote:

Originally Posted by teckk (Post 6364965)
Open a python3 shell, and see if you can import tkinter. If not what is the error.

Or just keep ignoring the advise you are given.

Edit:
https://docs.python.org/3/index.html
https://docs.python.org/3/library/tkinter.html

I think you will find I have already posted output from the python3 shell.

FlinchX 07-01-2022 03:31 PM

Quote:

Originally Posted by SAJM (Post 6364964)
That's exactly what I did. It seemed logical and has worked in the past.

I suppose by "in the past" you rather mean "for other software". This indeed works. For software with no build dependencies. For software with build dependencies, you need to install them explicitly yourself, even if you use sbopkg. Or make use of queues, as I explained above.

Quote:

Originally Posted by SAJM (Post 6364964)
I always understood the dependencies were all installed as a package when using sbopkg

No, not with sbopkg.

teckk 07-01-2022 03:38 PM

Quote:

I think you will find I have already posted output from the python3 shell.
Not once have you posted the output of a python3 shell. You posted the output to a python2 shell. They are different.

@FlinchX says Slack calls python3.python3

Are you going to post that or not?
Code:

python3
Then you can see if you can import tkinter in that shell. I am going to guess that you don't have tk/tcl installed. tkinter wont work without it.

Or, you could check and see if you have that installed.

teckk 07-01-2022 03:43 PM

After you get/have python3 working, tk/tcl installed so that tkinter will work...

Here is a simple little test script to see if all is well, with tkinter.

test.py
Code:

#!/usr/bin/python

from tkinter import *
from tkinter import font
from tkinter import ttk
 
class A(Tk):
    def __init__(self,*args,**kwargs):
        Tk.__init__(self,*args,**kwargs)
        self.notebook = ttk.Notebook()
        self.geometry('600x600')
        self.add_tab()
        self.notebook.grid(row=0)
 
    def add_tab(self):
        tab1 = B(self.notebook)
        tab2 = C(self.notebook)
        tab3 = D(self.notebook)
        self.notebook.add(tab1,text="Tab1")
        self.notebook.add(tab2,text="Tab2")
        self.notebook.add(tab3,text="Tab3")

class B(Frame):
    def __init__(self,name,*args,**kwargs):
        Frame.__init__(self,*args,**kwargs)
        self.label = Label(self, text="Info for Tab1")
        self.label.config(font=24, bg='blue', fg='yellow')
        self.label.grid(row=1,column=0,padx=50,pady=100)
        self.name = name
 
class C(Frame):
    def __init__(self,name,*args,**kwargs):
        Frame.__init__(self,*args,**kwargs)
        self.label = Label(self, text="Info for Tab2")
        self.label.config(font=24, bg='green', fg='white')
        self.label.grid(row=1,column=0,padx=100,pady=150)
        self.name = name
     
class D(Frame):
    def __init__(self,name,*args,**kwargs):
        Frame.__init__(self,*args,**kwargs)
        self.label = Label(self, text="Info for Tab3")
        self.label.config(font=24, bg='yellow', fg='black')
        self.label.grid(row=1,column=0,padx=150,pady=200)
        self.name = name
 
my_app = A()
my_app.mainloop()

You can make that executable run it, or
Code:

python3 ./test.py

FlinchX 07-01-2022 03:44 PM

Quote:

Originally Posted by SAJM (Post 6364966)
I removed Python3 and reinstalled it

Again, how exactly did you install it? Via sbopkg as well? Is it this Python 3? http://slackbuilds.org/repository/14.2/python/python3/

SAJM 07-02-2022 05:42 AM

Quote:

Originally Posted by FlinchX (Post 6364974)
Again, how exactly did you install it? Via sbopkg as well? Is it this Python 3? http://slackbuilds.org/repository/14.2/python/python3/

Yes. With sbopkg

FlinchX 07-02-2022 06:12 AM

@SAJM Did you have a full 14.2 install before you started to install SBo things?

SAJM 07-02-2022 06:16 AM

Quote:

Originally Posted by teckk (Post 6364973)
After you get/have python3 working, tk/tcl installed so that tkinter will work...

Here is a simple little test script to see if all is well, with tkinter.

test.py
[

Code:

python3 ./test.py

Result:

[CODE}
bash-4.3$ python3 ./test.py
Traceback (most recent call last):
File "./test.py", line 3, in <module>
from tkinter import *
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$
[/CODE]

EDIT

oops I just noticed I should have run this after the Tk issue was resolved!!

SAJM 07-02-2022 06:20 AM

Im going to remove everything and start again in this order

1. Install Python3
2. Install Thonny

Paying particular attention to dependencies.

teckk 07-02-2022 06:46 AM

Does another Slacker know what slack package contains tcl/tk? Python3.7 + comes with tkinter. But it won't work without tk.

This
http://tcl.sourceforge.net/

https://docs.python.org/3/library/tkinter.html
https://www.geeksforgeeks.org/introduction-to-tkinter/
https://www.tutorialspoint.com/tcl-tk/index.htm
https://tkdocs.com/tutorial/install.html

SAJM 07-02-2022 07:37 AM

Im going to remove everything and start again in this order

1. Install Python3
2. Install Thonny

Paying particular attention to dependencies.

SAJM 07-02-2022 07:42 AM

Quote:

Originally Posted by FlinchX (Post 6365059)
@SAJM Did you have a full 14.2 install before you started to install SBo things?

It was a few years ago but as far as I remember, yes.

SAJM 07-02-2022 08:17 AM

Code:

bash-4.3# python3
Python 3.7.2 (default, Jul  2 2022, 13:59:41)
[GCC 5.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Python3 looks good
But it does not launch in the GUI, I don't know if that's a problem or not at this stage?

SAJM 07-02-2022 08:41 AM

Code:

bash-4.3# python3
Python 3.7.2 (default, Jul  2 2022, 13:59:41)
[GCC 5.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> python -m tkinter
  File "<stdin>", line 1
    python -m tkinter
                    ^
SyntaxError: invalid syntax
>>> python -m tkinter
  File "<stdin>", line 1
    python -m tkinter
                    ^
SyntaxError: invalid syntax
>>> tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'tkinter' is not defined
>>> imprt tkinter
  File "<stdin>", line 1
    imprt tkinter
                ^
SyntaxError: invalid syntax
>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, 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'
>>>

Still no tkinter

Petri Kaukasoina 07-02-2022 08:53 AM

Quote:

Originally Posted by teckk (Post 6365064)
Does another Slacker know what slack package contains tcl/tk? Python3.7 + comes with tkinter. But it won't work without tk.

Code:

$ (cd /var/adm/packages && ls -1 tcl* tk*)                   
tcl-8.6.5-x86_64-2
tclx-8.4.1-x86_64-3
tk-8.6.5-x86_64-2


SAJM 07-02-2022 09:17 AM

I do not believe pip is installed

[code]
bash-4.3# pip help
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/lib64/python3.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib64/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib64/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib64/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 17, in <module>
from pip._internal.locations import USER_CACHE_DIR, src_prefix
File "/usr/lib64/python3.7/site-packages/pip/_internal/locations/__init__.py", line 14, in <module>
from . import _distutils, _sysconfig
File "/usr/lib64/python3.7/site-packages/pip/_internal/locations/_sysconfig.py", line 8, in <module>
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/usr/lib64/python3.7/site-packages/pip/_internal/exceptions.py)
bash-4.3# [/ode]

I understood pip was installed with python?

SAJM 07-02-2022 09:23 AM

pip now installed

SAJM 07-02-2022 09:26 AM

OK there is some progress

Code:

bash-4.3# pip install tk
Collecting tk
  Cache entry deserialization failed, entry ignored
  Downloading https://files.pythonhosted.org/packages/a0/81/742b342fd642e672fbedecde725ba44db44e800dc4c936216c3c6729885a/tk-0.1.0.tar.gz
Installing collected packages: tk
  Running setup.py install for tk ... done
Successfully installed tk-0.1.0
You are using pip version 9.0.3, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
bash-4.3# pip install tkinter
Collecting tkinter
  Could not find a version that satisfies the requirement tkinter (from versions: )
No matching distribution found for tkinter
You are using pip version 9.0.3, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
bash-4.3# pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Downloading https://files.pythonhosted.org/packages/27/79/8a850fe3496446ff0d584327ae44e7500daf6764ca1a382d2d02789accf7/pip-20.3.4-py2.py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 56kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-20.3.4
You are using pip version 20.3.4, however version 22.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
bash-4.3# pip install tkinter
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter
bash-4.3#


SAJM 07-02-2022 09:39 AM

[code]
You should consider upgrading via the 'pip install --upgrade pip' command.
bash-4.3# pip install tkinter
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter
bash-4.3#
[/quote]

How do I tell pip to use python3?

SAJM 07-02-2022 09:44 AM

Here is the problem I think
Do I uninstall python2.
I didn't do that earlier in case I messed up with a dependency for an existing program

Code:

bash-4.3# pip -V
pip 20.3.4 from /usr/lib64/python2.7/site-packages/pip (python 2.7)


SAJM 07-02-2022 10:01 AM

Not sure what this is telling me?

Code:

bash-4.3# sbofind pip
It looks like you haven't run "sbosnap fetch" yet.
Would you like me to do this now? [y] y
Pulling SlackBuilds tree...
    111,473,616 100%  196.02kB/s    0:09:15 (xfr#57394, to-chk=0/65943) 
SBo:    aeolus 0.9.0
Path:  /usr/sbo/repo/audio/aeolus

SBo:    pip2tgz 0.4
Path:  /usr/sbo/repo/development/pip2tgz

SBo:    pip 9.0.3
Path:  /usr/sbo/repo/python/pip

SBo:    pipdeptree 0.11.0
Path:  /usr/sbo/repo/python/pipdeptree

SBo:    piprot 0.9.10
Path:  /usr/sbo/repo/python/piprot

SBo:    pipstat 0.2.1
Path:  /usr/sbo/repo/python/pipstat

SBo:    python-joblib 0.17.0
Path:  /usr/sbo/repo/python/python-joblib

SBo:    ruffus 2.8.4
Path:  /usr/sbo/repo/python/ruffus


bash-4.3#


SAJM 07-02-2022 10:32 AM

Stack overflow at
https://stackoverflow.com/questions/...d-of-python2-7

suggested:
Code:


bash-4.3# python3 -m pip install --upgrade --force pip
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 "/usr/lib64/python3.7/site-packages/pip/__main__.py", line 16, in <module>
    from pip._internal import main as _main  # isort:skip # noqa
  File "/usr/lib64/python3.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/lib64/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/lib64/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/lib64/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 17, in <module>
    from pip._internal.locations import USER_CACHE_DIR, src_prefix
  File "/usr/lib64/python3.7/site-packages/pip/_internal/locations/__init__.py", line 14, in <module>
    from . import _distutils, _sysconfig
  File "/usr/lib64/python3.7/site-packages/pip/_internal/locations/_sysconfig.py", line 8, in <module>
    from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/usr/lib64/python3.7/site-packages/pip/_internal/exceptions.py)
bash-4.3#


SAJM 07-02-2022 11:08 AM

These from the same source did not work.

python3 -m pip install tk

or

pip3 install --upgrade --force pip

SAJM 07-02-2022 11:13 AM

That's it. I'm defeated

I could uninstall Python 2 but as I mentioned earlier I'm nervous about messing something else up that may be depending on it.

Petri Kaukasoina 07-02-2022 11:22 AM

Quote:

Originally Posted by teckk (Post 6364972)
I am going to guess that you don't have tk/tcl installed. tkinter wont work without it.

Or, you could check and see if you have that installed.

Quote:

Originally Posted by SAJM (Post 6365128)
That's it. I'm defeated

So, did you check if you have tk/tcl installed?

SAJM 07-02-2022 11:49 AM

Quote:

Originally Posted by Petri Kaukasoina (Post 6365131)
So, did you check if you have tk/tcl installed?

See my message 39
tk is installed but I think it is defaulting to python2

SAJM 07-02-2022 11:58 AM

However when I do this:

Code:

bash-4.3# which tk
which: no tk in (/usr/local/sbin:/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin)


BrunoLafleur 07-02-2022 12:33 PM

Why did you do :
pip install tk
pip install tkinter
?

for python3 it is like I said some posts above :
pip3 install tk
and maybe :
pip3 install tkinter

pip3 is for python3 and pip for python which is python2

tkinter is only for python3

Just to verify if tk for python3 is here as it seems something is missing.

BrunoLafleur 07-02-2022 12:42 PM

To test if Tcl and Tk are installed, you can also test if wish is present :
> which wish

tkinter is a module for Python3 which encapsulate Tcl/Tk. It needs Tcl and Tk.

So if tkinter is installed it won't work without Tcl and Tk installed.
Or tkinter is not installed.

pip3 will tell you in either case.


All times are GMT -5. The time now is 06:32 AM.