LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-01-2022, 01:23 PM   #16
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Rep: Reputation: Disabled

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.
 
Old 07-01-2022, 02:17 PM   #17
SAJM
Member
 
Registered: Nov 2012
Location: Essex UK
Distribution: Slackware 15
Posts: 269

Original Poster
Rep: Reputation: Disabled
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
 
Old 07-01-2022, 03:00 PM   #18
SAJM
Member
 
Registered: Nov 2012
Location: Essex UK
Distribution: Slackware 15
Posts: 269

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by FlinchX View Post
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
 
Old 07-01-2022, 03:10 PM   #19
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
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

Last edited by teckk; 07-01-2022 at 03:11 PM.
 
Old 07-01-2022, 03:12 PM   #20
SAJM
Member
 
Registered: Nov 2012
Location: Essex UK
Distribution: Slackware 15
Posts: 269

Original Poster
Rep: Reputation: Disabled
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

Last edited by SAJM; 07-01-2022 at 03:15 PM.
 
Old 07-01-2022, 03:20 PM   #21
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
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
 
Old 07-01-2022, 03:30 PM   #22
SAJM
Member
 
Registered: Nov 2012
Location: Essex UK
Distribution: Slackware 15
Posts: 269

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
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.
 
Old 07-01-2022, 03:31 PM   #23
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Rep: Reputation: Disabled
Quote:
Originally Posted by SAJM View Post
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 View Post
I always understood the dependencies were all installed as a package when using sbopkg
No, not with sbopkg.
 
Old 07-01-2022, 03:38 PM   #24
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
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.
 
Old 07-01-2022, 03:43 PM   #25
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,137
Blog Entries: 6

Rep: Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826Reputation: 1826
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
 
Old 07-01-2022, 03:44 PM   #26
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Rep: Reputation: Disabled
Quote:
Originally Posted by SAJM View Post
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/
 
Old 07-02-2022, 05:42 AM   #27
SAJM
Member
 
Registered: Nov 2012
Location: Essex UK
Distribution: Slackware 15
Posts: 269

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by FlinchX View Post
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
 
Old 07-02-2022, 06:12 AM   #28
FlinchX
Member
 
Registered: Nov 2017
Distribution: Slackware Linux
Posts: 666

Rep: Reputation: Disabled
@SAJM Did you have a full 14.2 install before you started to install SBo things?
 
Old 07-02-2022, 06:16 AM   #29
SAJM
Member
 
Registered: Nov 2012
Location: Essex UK
Distribution: Slackware 15
Posts: 269

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
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!!

Last edited by SAJM; 07-02-2022 at 06:18 AM.
 
Old 07-02-2022, 06:20 AM   #30
SAJM
Member
 
Registered: Nov 2012
Location: Essex UK
Distribution: Slackware 15
Posts: 269

Original Poster
Rep: Reputation: Disabled
Im going to remove everything and start again in this order

1. Install Python3
2. Install Thonny

Paying particular attention to dependencies.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Learn to code with Thonny -- a Python IDE for beginners LXer Syndicated Linux News 0 02-19-2018 05:21 AM
When Centos 6.3 starting,All services starting OK and starting Atd: OK .And stop scr. DeSouffle Linux - General 4 08-29-2013 12:46 AM
[SOLVED] Starting File System .. Starting File System .. Starting File System .. Starting File rmknox Linux - Newbie 3 08-15-2010 11:30 PM
Starting apps after starting xfce?? gtgoku Slackware 2 08-21-2004 01:49 PM
starting kpppd w/ ximian or starting ximian w/ kde ergo_sum Linux - Newbie 8 12-02-2003 05:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration