A fix for pylab and TkAgg plotting in SAGE (Mac OS X)

L

Lou Pecora

A few weeks ago I posted a problem with Mac OS X with matplotlib in the
SAGE distribution in which attempting to import pylab gave an error
message which stated that there was an import error and the module
_tkagg could not be found. The problem appears to be with matplotlib
(I'm not clear about this). After much searching and some emailing I
have found a solution to this problem and it is easy to do.

Full credit goes to Eric Sonnendrucker who sent it to me.

Here it is:

1) Download the Tcl/Tk sources (go to http://www.tcl.tk/, click on Get
Tcl/Tk Now, click on Sources Download Page,, download the latest
version).

2) In the Terminal cd to the unix folder in the tcl folder. Compile the
unix version (of Tcl and Tk) as follows
../configure --enable-framework --disable-xft
make
make install

3) Install SAGE from source. Download the SAGE source code (go to
http://www.sagemath.org/, click on Download, click on Download complete
source code). In the terminal cd to the SAGE folder and *before* you
run the sage install you need to set

SAGE_MATPLOTLIB_GUI=True

using export SAGE_MATPLOTLIB_GUI=True with bash. The installer then
picks it up automatically.

Complete the SAGE installation by typing make and hit return. That's it.
This will take a while (up to a few hours depending on the computer).

4) You might also need to modify you matplotlibrc by setting
backend='TkAgg' after the installation


Test this by doing an import pylab in sage. You should not get an error.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top