Ubuntu package "python3" does not include tkinter

L

lcrocker

Am I mistaken in my belief that tkinter is a non-optional part of the
Python language? I installed the "python3" package on Ubuntu, and
tkinter is not included--it's an optional package "python3-tk" that
has to be installed separately. I reported this as a bug as was
summarily slapped down.

Can we apply some pressure to Ubuntu to fix this? Python is a
trademark, is it not? Can Ubuntu legally claim that their "Python"
package is an implementation of the language if it does not include
the whole language?
 
J

Joel Goldstick

Am I mistaken in my belief that tkinter is a non-optional part of the
Python language? I installed the "python3" package on Ubuntu, and
tkinter is not included--it's an optional package "python3-tk" that
has to be installed separately. I reported this as a bug as was
summarily slapped down.

Can we apply some pressure to Ubuntu to fix this? Python is a
trademark, is it not? Can Ubuntu legally claim that their "Python"
package is an implementation of the language if it does not include
the whole language?

Does this help?

Try the correct command for your version at the Python prompt:
 
L

lcrocker

Thanks, but I'm not having any trouble running tkinter, it works just
fine. I have an issue with the fact that it's optional. It reflects
badly on the language and community if we allow just anyone to call
something "Python" that doesn't meet some minimum standard of quality.
Java has its compliance tests: if your implementation doesn't pass,
you can't call it "Java". I'm asking if there's something similar for
Python, because Ubuntu's Python 3 doesn't pass the test.
 
A

Andrew Berg

Am I mistaken in my belief that tkinter is a non-optional part of the
Python language? I installed the "python3" package on Ubuntu, and
tkinter is not included--it's an optional package "python3-tk" that
has to be installed separately. I reported this as a bug as was
summarily slapped down.
Forcing Tkinter as a dependency would result in a ton of things being installed to support it. Why should a web server using Django have X
installed and running because Python /can/ support a GUI in the standard library? It's trivial to install Tkinter if you need it, but it
would be a huge mess to try to remove it from an installation that requires it - even if you never use Tkinter. Ubuntu is far from alone
here. FreeBSD (and probably the other BSDs) and most Linux distros do something similar. There is zero reason to force Tkinter and its
dependencies on all Python users.
 
L

lcrocker

On 2013.04.19 12:17, lcrocker wrote:> Am I mistaken in my belief that tkinter is a non-optional part of the

Forcing Tkinter as a dependency would result in a ton of things being installed to support it. Why should a web server using Django have X
installed and running because Python /can/ support a GUI in the standard library? It's trivial to install Tkinter if you need it, but it
would be a huge mess to try to remove it from an installation that requires it - even if you never use Tkinter. Ubuntu is far from alone
here. FreeBSD (and probably the other BSDs) and most Linux distros do something similar. There is zero reason to force Tkinter and its
dependencies on all Python users.

I understand that for something like a server distribution, but Ubuntu
is a user-focused desktop distribution. It has a GUI, always. The
purpose of a distro like that is to give users a good experience. If I
install Python on Windows, I get to use Python. On Ubuntu, I don't,
and I think that will confuse some users. I recently recommended
Python to a friend who wants to start learning programming. Hurdles
like this don't help someone like him.
 
P

Peter Otten

lcrocker said:
Am I mistaken in my belief that tkinter is a non-optional part of the
Python language? I installed the "python3" package on Ubuntu, and
tkinter is not included--it's an optional package "python3-tk" that
has to be installed separately. I reported this as a bug as was
summarily slapped down.

Can we apply some pressure to Ubuntu to fix this? Python is a
trademark, is it not? Can Ubuntu legally claim that their "Python"
package is an implementation of the language if it does not include
the whole language?

Thank you for bringing this criminal offense to our attention. Right now a
PSU team is readying their black helicopters to get Mr Shuttleworth and his
accompli
 
R

rusi

I understand that for something like a server distribution, but Ubuntu
is a user-focused desktop distribution. It has a GUI, always. The
purpose of a distro like that is to give users a good experience. If I
install Python on Windows, I get to use Python. On Ubuntu, I don't,
and I think that will confuse some users. I recently recommended
Python to a friend who wants to start learning programming. Hurdles
like this don't help someone like him.

Well I guess you could take the example of kde.
kde has a kde-standard and a kde-full.
Likewise one could imagine python-standard being what is currently
called python and python-full pulling in other dependencies like
tkinter.
If there were a number of such it may even make sense, if not it looks
like overkill (to me)
 
T

Terry Jan Reedy

Am I mistaken in my belief that tkinter is a non-optional part of the
Python language?

Yes. The PSF CPython Windows installer makes installation of
tcl/tk/tkinter optional. The build files will compile and build Python
without tkinter and without other modules that depend on other c
libraries (example, lzma). I believe one can build python 2 without
unicode, which is much more 'core' than the Tkinter module.
I installed the "python3" package on Ubuntu, and
tkinter is not included--it's an optional package "python3-tk" that
has to be installed separately. I reported this as a bug as was
summarily slapped down.

I hope it was done politely ;-).

Overall, Ubuntu is relatively advanced in moving to new versions. I
believe I read that they are hoping to make 3.3 the default Python as
soon as possible.
 
S

Steven D'Aprano

Am I mistaken in my belief that tkinter is a non-optional part of the
Python language? I installed the "python3" package on Ubuntu, and
tkinter is not included--it's an optional package "python3-tk" that has
to be installed separately. I reported this as a bug as was summarily
slapped down.

Personally, I think that is a silly design by Ubuntu, but tkinter is
optional and they're free to distribute Python with or without it. That
becomes a *quality of implementation* issue: some distributions may be
more complete, easier to install, more up-to-date, etc. than others, but
they're still Python.

There is Python the language, which is distinct from the CPython
implementation (to say nothing of other implementations like Jython,
IronPython, Stackless, PyPy, ...), and then there is the standard
library. Much of the standard library is optional, although unfortunately
the documentation doesn't really make that as clear as it should.

Tkinter depends on you have Tk/Tcl installed, which on Linux and Unix
systems depends on you having X installed. Personally, I think that a
good packaging system should ensure that once you install Tk/Tcl, tkinter
should "just work". But there may be technical reasons why this is
impossible.

If you ever build Python from source, you will often get warnings that it
could not build certain modules. I spent a fruitless couple of hours last
week trying to install Python 2.7 from scratch with sqlite, before giving
up. What I got was still Python 2.7. It was just Python 2.7 without
sqlite (and four or five other modules, which I don't care about and
don't remember).

Can we apply some pressure to Ubuntu to fix this? Python is a trademark,
is it not? Can Ubuntu legally claim that their "Python" package is an
implementation of the language if it does not include the whole
language?

Tkinter is not part of the language. The tkinter module is an interface
to another language, not part of Python the language itself. There are
platforms where Tk/Tcl do not exist, platforms which may not even have a
GUI environment at all. Do you really intend to say that it is forbidden
to have Python on such platforms?
 
S

Sibylle Koczian

Am 19.04.2013 19:42, schrieb lcrocker:
I understand that for something like a server distribution, but Ubuntu
is a user-focused desktop distribution. It has a GUI, always. The
purpose of a distro like that is to give users a good experience. If I
install Python on Windows, I get to use Python. On Ubuntu, I don't,
and I think that will confuse some users. I recently recommended
Python to a friend who wants to start learning programming. Hurdles
like this don't help someone like him.

It's _so_ easy to install an additional package on Ubuntu that that
really shouldn't be called a 'hurdle'. Using tkinter or any other GUI
toolkit is much more difficult for a beginner.
 
S

Steven D'Aprano

Am 19.04.2013 19:42, schrieb lcrocker:

It's _so_ easy to install an additional package on Ubuntu that that
really shouldn't be called a 'hurdle'. Using tkinter or any other GUI
toolkit is much more difficult for a beginner.

It's only easy to install a package on Ubuntu if you know that you have
to, and can somehow work out the name of the package.
 
R

rusi

It's only easy to install a package on Ubuntu if you know that you have
to, and can somehow work out the name of the package.

Yes

There is some infrastructure in debian/ubuntu (not sure what/where/
how) which behaves something like so:
$peculiar_command
peculiar_command no found but exists in package FooBar

I believe that repackaged pythons (like debian's) should be able to
hook into this system and give better error messages than

ImportError: No module named Tkinter
 
A

Andrew Berg

It's only easy to install a package on Ubuntu if you know that you have
to, and can somehow work out the name of the package.
I haven't worked with Ubuntu or apt-based packaging in ages, but isn't this kind of information in a description message or something
(especially in a GUI frontend)?
 
R

rusi

On 2013.04.21 22:57, Steven D'Aprano wrote:> It's only easy to install a package on Ubuntu if you know that you have

I haven't worked with Ubuntu or apt-based packaging in ages, but isn't this kind of information in a description message or something
(especially in a GUI frontend)?

Of course... If you know where to look. (I think that's Steven's point
in the 'you know that you have to')

For a noob getting the error
ImportError: No module named Tkinter

it may be that
- he has not installed tkinter
- he has misspelled tkinter
- he has misspelled the import statement (yeah then he'll get syntax
error or somesuch… being a noob he does not know)

I personally know that one can put 'python' in the search box in
synaptic and fish around.
The point is that the noob to python may be a noob to linux/apt also.
 
A

Andrew Berg

Of course... If you know where to look. (I think that's Steven's point
in the 'you know that you have to')
I meant when installing it. I forgot for a moment that Ubuntu and many other Linux distros come with Python already installed.
 
R

Rui Maciel

lcrocker said:
I understand that for something like a server distribution, but Ubuntu
is a user-focused desktop distribution. It has a GUI, always.
Irrelevant.


The
purpose of a distro like that is to give users a good experience. If I
install Python on Windows, I get to use Python. On Ubuntu, I don't,
and I think that will confuse some users.

Nonsense. No one is keeping anyone off tkinter. If you want it, install
it. There are official packages in the repositories such as python-tk and
python3-tk. If someone else doesn't want them then they aren't forced to
pack their Ubuntu systems with more cruft. There's nothing worse than being
forced to install piles of irrelevant and useless stuff as a dependency to a
fundamental package.

I recently recommended
Python to a friend who wants to start learning programming. Hurdles
like this don't help someone like him.

If your friend believes that having to do an extra pair of clicks or typing
sudo apt-get install python-tk is an unbeatable hurdle then your friend's
computer skills are awfully lacking and he won't have much success learning
how to write programs.


Rui Maciel
 
R

Rui Maciel

Steven said:
It's only easy to install a package on Ubuntu if you know that you have
to, and can somehow work out the name of the package.

No one actually has to install tkinter. That's the whole point of providing
it as a separate package: only those who want to use it have to install it.
The rest of us don't.


Rui Maciel
 
S

Steven D'Aprano

No one actually has to install tkinter. That's the whole point of
providing it as a separate package: only those who want to use it have
to install it. The rest of us don't.

I think that if you are worrying about the overhead of the tkinter
bindings for Python, you're guilty of premature optimization. The tkinter
package in Python 3.3 is trivially small, under 2 MB.

Besides, how far do we go? Do we expect people to install (say):

python3-copy

so that those who don't need the copy module don't have to install it?

sudo apt-get python3 python3-copy python3-dis python3-doctest \
python3-csv python3-logging python3-shutil ...


There are advantages to having the *standard library* actually be, you
know, *standard*.

In my perfect world, the tk/tcl bindings and the tkinter package would be
installed with any Python installation. Naturally they won't work if you
don't install Tcl, but to make them work, all you need is:

sudo apt-get python3 tcl

Don't want Tcl? Fine, don't install it, and "import tkinter" will fail at
import time, preferably with a sensible error message like "Tcl not
installed".

Naturally I'm just talking about the standard CPython implementation on
Linux systems where Tcl is standard. If you have an embedded system,
where tkinter's 2MB is *not* trivially small, or a platform where Tcl
does not exist, then that's a different story. But in a standard Linux
desktop install of Python, tkinter should Just Work once you install Tcl.

In my perfect world.
 
A

Andrew Berg

I think that if you are worrying about the overhead of the tkinter
bindings for Python, you're guilty of premature optimization. The tkinter
package in Python 3.3 is trivially small, under 2 MB.

Besides, how far do we go? Do we expect people to install (say):

python3-copy

so that those who don't need the copy module don't have to install it?
Much of the stdlib doesn't rely on anything but the core interpreter. tkinter by itself is not the issue. As you said, the bindings are
tiny. However, in order to be usable, it requires quite a few things - most notably X. On desktop Linux, this is already installed, but on
server systems, it generally is not (or at least shouldn't be in most cases). Going back to my example of a web server using a Python-based
framework, I'll repeat that there is no reason such a system should have X even installed in order to serve web pages. Even on a lean, mean
server machine, CPython requires only a few extra libraries. Add tkinter, and suddenly you have to install a LOT of things. If you plan to
actually use tkinter, this is fine. If not, you've just added a lot of stuff that you don't need. This adds unnecessary overhead in several
places (like your package system's database).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top