unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20889: python Tkinter
@ 2015-06-24  7:14 Federico Beffa
  2015-07-04  0:34 ` Cyril Roelandt
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Federico Beffa @ 2015-06-24  7:14 UTC (permalink / raw)
  To: 20889

The python package does not provide Tkinter which is part of the
Python Standard Library
https://docs.python.org/3/library/tkinter.html?highlight=tkinter#module-tkinter

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-06-24  7:14 bug#20889: python Tkinter Federico Beffa
@ 2015-07-04  0:34 ` Cyril Roelandt
  2015-07-05 10:16   ` Ludovic Courtès
  2015-11-09  9:42 ` Federico Beffa
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2015-07-04  0:34 UTC (permalink / raw)
  To: Federico Beffa, 20889

On 06/24/2015 09:14 AM, Federico Beffa wrote:
> The python package does not provide Tkinter which is part of the
> Python Standard Library
> https://docs.python.org/3/library/tkinter.html?highlight=tkinter#module-tkinter
> 

I think we need to add tcl and tk to the inputs, and add the
corresponding "-I" and "-L" flags to the configure flags. The issue is
that tk depends on Python (through libx11, which depends on libxcb,
which depends on Python), so we end up with a circular dependency
leading to what I reported in
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20967 .

I think we should:
- rename the Python package to "python-without-tkinter" or
"python-minimal" and use that as a dependency in xorg.scm;
- define a "python" package that would inherit the "minimal Python"
package and add the dependency on tcl/tk to it.


WDYT ?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-07-04  0:34 ` Cyril Roelandt
@ 2015-07-05 10:16   ` Ludovic Courtès
  2015-07-05 22:39     ` Cyril Roelandt
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2015-07-05 10:16 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: 20889, Federico Beffa

Cyril Roelandt <tipecaml@gmail.com> skribis:

> On 06/24/2015 09:14 AM, Federico Beffa wrote:
>> The python package does not provide Tkinter which is part of the
>> Python Standard Library
>> https://docs.python.org/3/library/tkinter.html?highlight=tkinter#module-tkinter
>> 
>
> I think we need to add tcl and tk to the inputs, and add the
> corresponding "-I" and "-L" flags to the configure flags. The issue is
> that tk depends on Python (through libx11, which depends on libxcb,
> which depends on Python), so we end up with a circular dependency
> leading to what I reported in
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20967 .
>
> I think we should:
> - rename the Python package to "python-without-tkinter" or
> "python-minimal" and use that as a dependency in xorg.scm;
> - define a "python" package that would inherit the "minimal Python"
> package and add the dependency on tcl/tk to it.

How frequently do Python packages rely on the availability of Tkinter?

I’m asking because it might be that we could keep the default Python
without Tk, and only use the Tk-enabled Python for the few packages that
need it, if it’s rare enough.

WDYT?

Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-07-05 10:16   ` Ludovic Courtès
@ 2015-07-05 22:39     ` Cyril Roelandt
  2015-07-06  7:27       ` Federico Beffa
  0 siblings, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2015-07-05 22:39 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 20889, Federico Beffa

On 07/05/2015 12:16 PM, Ludovic Courtès wrote:
> I’m asking because it might be that we could keep the default Python
> without Tk, and only use the Tk-enabled Python for the few packages that
> need it, if it’s rare enough.

No, we do not want that. Users who install Python expect to be able to
import tkinter, since it is part of the standard library.

Cyril.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-07-05 22:39     ` Cyril Roelandt
@ 2015-07-06  7:27       ` Federico Beffa
  2015-07-06 10:21         ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Federico Beffa @ 2015-07-06  7:27 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: 20889

On Mon, Jul 6, 2015 at 12:39 AM, Cyril Roelandt <tipecaml@gmail.com> wrote:
> On 07/05/2015 12:16 PM, Ludovic Courtès wrote:
>> I’m asking because it might be that we could keep the default Python
>> without Tk, and only use the Tk-enabled Python for the few packages that
>> need it, if it’s rare enough.
>
> No, we do not want that. Users who install Python expect to be able to
> import tkinter, since it is part of the standard library.

I agree with Cyril.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-07-06  7:27       ` Federico Beffa
@ 2015-07-06 10:21         ` Ludovic Courtès
  2015-07-06 11:17           ` Andreas Enge
                             ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Ludovic Courtès @ 2015-07-06 10:21 UTC (permalink / raw)
  To: Federico Beffa; +Cc: 20889

Federico Beffa <beffa@ieee.org> skribis:

> On Mon, Jul 6, 2015 at 12:39 AM, Cyril Roelandt <tipecaml@gmail.com> wrote:
>> On 07/05/2015 12:16 PM, Ludovic Courtès wrote:
>>> I’m asking because it might be that we could keep the default Python
>>> without Tk, and only use the Tk-enabled Python for the few packages that
>>> need it, if it’s rare enough.
>>
>> No, we do not want that. Users who install Python expect to be able to
>> import tkinter, since it is part of the standard library.
>
> I agree with Cyril.

OK.  Then we effectively need to proceed as you suggest: Build
python-minimal (which does not depend on Tk), build Tk, and then build
python.

But we should make sure that python-minimal is not retained, if
possible.

Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-07-06 10:21         ` Ludovic Courtès
@ 2015-07-06 11:17           ` Andreas Enge
  2015-10-07 22:18           ` Ludovic Courtès
  2015-10-07 22:19           ` Ludovic Courtès
  2 siblings, 0 replies; 14+ messages in thread
From: Andreas Enge @ 2015-07-06 11:17 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 20889, Federico Beffa

On Mon, Jul 06, 2015 at 12:21:11PM +0200, Ludovic Courtès wrote:
> OK.  Then we effectively need to proceed as you suggest: Build
> python-minimal (which does not depend on Tk), build Tk, and then build
> python.

And maybe this python-minimal could be smaller than the current python,
in the sense of "minimal"?

Andreas

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-07-06 10:21         ` Ludovic Courtès
  2015-07-06 11:17           ` Andreas Enge
@ 2015-10-07 22:18           ` Ludovic Courtès
  2015-10-07 22:19           ` Ludovic Courtès
  2 siblings, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2015-10-07 22:18 UTC (permalink / raw)
  To: Federico Beffa; +Cc: 20889-done

ludo@gnu.org (Ludovic Courtès) skribis:

> OK.  Then we effectively need to proceed as you suggest: Build
> python-minimal (which does not depend on Tk), build Tk, and then build
> python.

Done in commits 95288fc and afa181f.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-07-06 10:21         ` Ludovic Courtès
  2015-07-06 11:17           ` Andreas Enge
  2015-10-07 22:18           ` Ludovic Courtès
@ 2015-10-07 22:19           ` Ludovic Courtès
  2 siblings, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2015-10-07 22:19 UTC (permalink / raw)
  To: Federico Beffa; +Cc: 20889-done

ludo@gnu.org (Ludovic Courtès) skribis:

> OK.  Then we effectively need to proceed as you suggest: Build
> python-minimal (which does not depend on Tk), build Tk, and then build
> python.

Done in commits 95288fc and afa181f.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-06-24  7:14 bug#20889: python Tkinter Federico Beffa
  2015-07-04  0:34 ` Cyril Roelandt
@ 2015-11-09  9:42 ` Federico Beffa
  2015-11-11 21:44   ` Ludovic Courtès
  2015-11-09 10:36 ` Federico Beffa
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Federico Beffa @ 2015-11-09  9:42 UTC (permalink / raw)
  To: 20889

If I start python3 and do:

-------------------------------------------------------
$ python3
Python 3.4.3 (default, Oct  9 2015, 22:53:58)
[GCC 4.9.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> root = tkinter.Tk()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/lib/python3.4/tkinter/__init__.py",
line 1851, in __init__
    self.tk = _tkinter.create(screenName, baseName, className,
interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable tk.tcl in the following directories:
    /gnu/store/sd4fcdk9yzh1s0230fjx1yfwk9pl71bf-tcl-8.6.4/lib/tcl8.6/tk8.6
/gnu/store/sd4fcdk9yzh1s0230fjx1yfwk9pl71bf-tcl-8.6.4/lib/tk8.6
/gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/lib/tk8.6
/gnu/store/lib/tk8.6
/gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/library



This probably means that tk wasn't installed properly.
-------------------------------------------------------

Did you successfully test it?

Regards,
Fede

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-06-24  7:14 bug#20889: python Tkinter Federico Beffa
  2015-07-04  0:34 ` Cyril Roelandt
  2015-11-09  9:42 ` Federico Beffa
@ 2015-11-09 10:36 ` Federico Beffa
  2015-11-09 10:59 ` Federico Beffa
  2015-12-01 20:19 ` bug#20889: Tkinter moved to separate output Federico Beffa
  4 siblings, 0 replies; 14+ messages in thread
From: Federico Beffa @ 2015-11-09 10:36 UTC (permalink / raw)
  To: 20889

with:

$TCLLIBPATH=/gnu/store/c4rpx4050d0qkccwbzggabag403b31l3-tk-8.6.4/lib python3

it works. So I guess that 'tcl' needs a search-path-specification.

Regards,
Fede

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-06-24  7:14 bug#20889: python Tkinter Federico Beffa
                   ` (2 preceding siblings ...)
  2015-11-09 10:36 ` Federico Beffa
@ 2015-11-09 10:59 ` Federico Beffa
  2015-12-01 20:19 ` bug#20889: Tkinter moved to separate output Federico Beffa
  4 siblings, 0 replies; 14+ messages in thread
From: Federico Beffa @ 2015-11-09 10:59 UTC (permalink / raw)
  To: 20889

... and the configure script for Python defines the flag
'--with-tcltk-libs'. Maybe that would help...

Regards,
Fede

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: python Tkinter
  2015-11-09  9:42 ` Federico Beffa
@ 2015-11-11 21:44   ` Ludovic Courtès
  0 siblings, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2015-11-11 21:44 UTC (permalink / raw)
  To: Federico Beffa; +Cc: 20889

Federico Beffa <beffa@ieee.org> skribis:

> >>> root = tkinter.Tk()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/lib/python3.4/tkinter/__init__.py",
> line 1851, in __init__
>     self.tk = _tkinter.create(screenName, baseName, className,
> interactive, wantobjects, useTk, sync, use)
> _tkinter.TclError: Can't find a usable tk.tcl in the following directories:
>     /gnu/store/sd4fcdk9yzh1s0230fjx1yfwk9pl71bf-tcl-8.6.4/lib/tcl8.6/tk8.6
> /gnu/store/sd4fcdk9yzh1s0230fjx1yfwk9pl71bf-tcl-8.6.4/lib/tk8.6
> /gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/lib/tk8.6
> /gnu/store/lib/tk8.6
> /gnu/store/y5x6c38fzrbfl80jxrgjd6py2k88x12a-python-3.4.3/library

This error message comes from Tcl, in file ‘auto.tcl’, procedure
‘tcl_findLibrary’.

We’d need to find where the call comes from and hard-code a search path
in there maybe?

> Did you successfully test it?

I just did “import tkinter.”

> with:
>
> $TCLLIBPATH=/gnu/store/c4rpx4050d0qkccwbzggabag403b31l3-tk-8.6.4/lib python3
>
> it works. So I guess that 'tcl' needs a search-path-specification.

Yes.  That wouldn’t help for Python though, where we need to hard-code
the search path somehow.

> ... and the configure script for Python defines the flag
> '--with-tcltk-libs'. Maybe that would help...

I don’t think it would help because Python finds Tcl and Tk anyway.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* bug#20889: Tkinter moved to separate output
  2015-06-24  7:14 bug#20889: python Tkinter Federico Beffa
                   ` (3 preceding siblings ...)
  2015-11-09 10:59 ` Federico Beffa
@ 2015-12-01 20:19 ` Federico Beffa
  4 siblings, 0 replies; 14+ messages in thread
From: Federico Beffa @ 2015-12-01 20:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 宋文武, Guix-devel, iyzsong, 20889

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

Federico Beffa <beffa@ieee.org> writes:

> On Sun, Nov 29, 2015 at 11:09 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>> Federico Beffa <beffa@ieee.org> skribis:

> Looking into the failed build directory, it seems that PKG_CONFIG_PATH
> is set correctly. Still, it doesn't get the correct flags.

The attached patch fixes the problem and I can now plot with TkAgg :-)

Thanks for making Tkinter available!
Fede

[-- Attachment #2: 0001-gnu-python-matplotlib-Add-TkAgg-backend-and-update-t.patch --]
[-- Type: text/x-diff, Size: 4427 bytes --]

From b40cf5522bcc15166ca07dfbae50167203d29e2d Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Tue, 1 Dec 2015 17:20:59 +0100
Subject: [PATCH 1/2] gnu: python-matplotlib: Add 'TkAgg' backend and update to
 version '1.4.3'.

* gnu/packages/python.scm (python-matplotlib): Do it.
* gnu/packages/patches/matplotlib-setupext-tk.patch: New file.
---
 gnu/packages/patches/matplotlib-setupext-tk.patch | 30 +++++++++++++++++++++++
 gnu/packages/python.scm                           | 17 +++++++++----
 2 files changed, 42 insertions(+), 5 deletions(-)
 create mode 100644 gnu/packages/patches/matplotlib-setupext-tk.patch

diff --git a/gnu/packages/patches/matplotlib-setupext-tk.patch b/gnu/packages/patches/matplotlib-setupext-tk.patch
new file mode 100644
index 0000000..cd0332e
--- /dev/null
+++ b/gnu/packages/patches/matplotlib-setupext-tk.patch
@@ -0,0 +1,30 @@
+Use 'pkg-config' instead of heuristics to find 'tk' flags.
+
+--- matplotlib-1.4.3/setupext.py.orig	2015-12-01 14:21:19.554417453 +0100
++++ matplotlib-1.4.3/setupext.py	2015-12-01 14:35:51.999928797 +0100
+@@ -1457,7 +1457,7 @@
+             p = subprocess.Popen(
+                 '. %s ; eval echo ${%s}' % (file, varname),
+                 shell=True,
+-                executable="/bin/sh",
++                executable="sh",
+                 stdout=subprocess.PIPE)
+             result = p.communicate()[0]
+             return result.decode('ascii')
+@@ -1601,8 +1601,15 @@
+             #      of distros.
+ 
+             # Query Tcl/Tk system for library paths and version string
++            def getoutput(s):
++                ret = os.popen(s).read().strip()
++                return ret
+             try:
+-                tcl_lib_dir, tk_lib_dir, tk_ver = self.query_tcltk()
++                #tcl_lib_dir, tk_lib_dir, tk_ver = self.query_tcltk()
++                pkg_config_res = getoutput('pkg-config --libs tk').split()
++                tk_ver = pkg_config_res[-1][-3:]
++                tcl_lib_dir = pkg_config_res[0][2:] + '/tcl' + tk_ver
++                tk_lib_dir = pkg_config_res[1][2:] + '/tk' + tk_ver
+             except:
+                 tk_ver = ''
+                 result = self.hardcoded_tcl_config()
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 39d0751..5e23bab 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -3175,7 +3175,7 @@ transcendental functions).")
 (define-public python-matplotlib
   (package
     (name "python-matplotlib")
-    (version "1.4.2")
+    (version "1.4.3")
     (source
      (origin
        (method url-fetch)
@@ -3183,13 +3183,15 @@ transcendental functions).")
                            "/matplotlib-" version ".tar.gz"))
        (sha256
         (base32
-         "0m6v9nwdldlwk22gcd339zg6mny5m301fxgks7z8sb8m9wawg8qp"))))
+         "1dn05cvd0g984lzhh72wa0z93psgwshbbg93fkab6slx5m3l95av"))
+       (patches (list (search-patch "matplotlib-setupext-tk.patch")))))
     (build-system python-build-system)
     (outputs '("out" "doc"))
     (propagated-inputs ; the following packages are all needed at run time
      `(("python-pyparsing" ,python-pyparsing)
        ("python-pygobject" ,python-pygobject)
        ("gobject-introspection" ,gobject-introspection)
+       ("python" ,python "tk")
        ;; The 'gtk+' package (and 'gdk-pixbuf', 'atk' and 'pango' propagated
        ;; from 'gtk+') provides the required 'typelib' files used by
        ;; 'gobject-introspection'. The location of these files is set with the
@@ -3224,7 +3226,8 @@ transcendental functions).")
        ;; FIXME: Add backends when available.
        ;("python-wxpython" ,python-wxpython)
        ;("python-pyqt" ,python-pyqt)
-       ))
+       ("tcl" ,tcl)
+       ("tk" ,tk)))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("texlive" ,texlive)
@@ -3243,8 +3246,12 @@ transcendental functions).")
             (setenv "HOME" (getcwd))
             (call-with-output-file "setup.cfg"
               (lambda (port)
-                (format port "[rc_options]~%
-backend = GTK3Agg~%")))))
+                (format port "[directories]~%
+basedirlist = ~a,~a~%
+[rc_options]~%
+backend = TkAgg~%"
+                        (assoc-ref inputs "tcl")
+                        (assoc-ref inputs "tk"))))))
         (alist-cons-after
          'install 'install-doc
          (lambda* (#:key outputs #:allow-other-keys)
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-12-01 20:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24  7:14 bug#20889: python Tkinter Federico Beffa
2015-07-04  0:34 ` Cyril Roelandt
2015-07-05 10:16   ` Ludovic Courtès
2015-07-05 22:39     ` Cyril Roelandt
2015-07-06  7:27       ` Federico Beffa
2015-07-06 10:21         ` Ludovic Courtès
2015-07-06 11:17           ` Andreas Enge
2015-10-07 22:18           ` Ludovic Courtès
2015-10-07 22:19           ` Ludovic Courtès
2015-11-09  9:42 ` Federico Beffa
2015-11-11 21:44   ` Ludovic Courtès
2015-11-09 10:36 ` Federico Beffa
2015-11-09 10:59 ` Federico Beffa
2015-12-01 20:19 ` bug#20889: Tkinter moved to separate output Federico Beffa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).