Ask Your Question

Tkinter for sage 5.0 on linux

asked 2012-06-07 04:39:00 -0500

Ed Scheinerman gravatar image

I'm using sage 5.0 on Ubuntu Linux. I would like to use Tkinter but it fails. I have Tk installed (works from ordinary python) and the development libraries are installed.

Here's what happens:

sage: from Tkinter import *
ImportError                               Traceback (most recent call last)

/home/ers/<ipython console> in <module>()

/usr/lib/sage/local/lib/python2.7/lib-tk/ in <module>()
     37     # Attempt to configure Tcl/Tk without requiring PATH
     38     import FixTk
---> 39 import _tkinter # If this fails your Python may not be configured for Tk
     40 tkinter = _tkinter # b/w compat for export
     41 TclError = _tkinter.TclError

ImportError: No module named _tkinter

I tried the instructions here: but that didn't work.

I tried a more simple

sage -f python

and got this:

Calling sage-spkg on 'python'
Extracting package /usr/lib/sage/spkg/standard/python-2.7.2.p4.spkg
-rw-r--r-- 1 root root 107 May 14 19:57 /usr/lib/sage/spkg/standard/python-2.7.2.p4.spkg
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
Error: failed to extract /usr/lib/sage/spkg/standard/python-2.7.2.p4.spkg

Help please!

BTW: The from Tkinter import * works perfectly on my Mac.


edit retag flag offensive close merge delete


Am trying to follow instructions at, Installing Visualization Tools on Linux (sage 4.7.1 on Ubuntu 12.04). These instructions recommend getting Tkinter to work. Have been unable to do so for similar reasons as post above. V. Braun suggests not using Tkinter, Should I ignore instructions under "Installing Visualization..." relating to Tkinter? Thanks, Bob

bbtp gravatar imagebbtp ( 2012-09-28 14:20:15 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-06-08 09:47:36 -0500

Volker Braun gravatar image

First of all, don't use Tkinter. There are plenty of reasonable GUI toolkits that you could use, but Tk is not one of them.

You extracted the binary tarball, which of course isn't linked to Tkinter. You need to compile from source. If you have the Tk development libraries installed, the compilation of python for Sage will pick up the dependencies.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-06-07 04:39:00 -0500

Seen: 380 times

Last updated: Jun 08 '12