Sage Days 15: Sage on Windows
system:sage

<h1 style="text-align: center;"><strong>Sage on Microsoft Windows</strong></h1>
<h3 style="text-align: center;"><strong>Sage Days 15</strong></h3>
<h3 style="text-align: center;"><strong>William Stein<br /></strong></h3>

{{{id=6|

///
}}}

<p>&nbsp;</p>
<p style="text-align: center;"><img src="windows-vista-logo.jpg" alt="" width="232" height="279" /></p>
<h2 style="text-align: left;"><strong>Sage and Microsoft Windows</strong>:</h2>
<ul>
<li>Windows users currently use VMware or http://sagenb.org.&nbsp; Sage supports Windows (Firefox, IE, and Safari) as a web client pretty well.&nbsp; For example, twice a week I teach my Sage course in a lab full of <em><strong>generic windows machines</strong></em> and all the students use a single Sage notebook server running off a single dual-processor VMware image running remotely (in fact on sagenb.org).&nbsp; This works.&nbsp;
<p>&nbsp;</p>
</li>
<li>There is <strong>huge demand </strong>by users to run Sage on Microsoft Windows.&nbsp; Overall Sage download stats since Feb 15 (thanks to Harald Schilly):</li>
</ul>
<p><span style="font-family: terminal,monaco;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. microsoft_windows(=vmware) 5,661&nbsp; &lt;--- by *far* most popular !!<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. linux/32bit &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; 3,077<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3. source code &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1,964<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4. apple_osx/intel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1,404<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5. linux/64bit &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1,070<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6. apple_osx/powerpc &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 372<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7. linux/atom &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 122<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8. apple_osx/ppc &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 98<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9. solaris&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10. linux/itanium &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 14</span></p>
<p><span style="font-family: terminal,monaco;">Total................................. 13797 (nearly 5000/month)<br /></span></p>
<p>&nbsp;</p>
<h2><strong>The Sage Port:</strong></h2>
<p><span style="font-family: terminal,monaco;"><span style="font-family: times new roman,times;">I started a</span></span><span style="font-family: terminal,monaco;"><span style="font-family: times new roman,times;"><strong> "fully native"</strong> port of Sage to Windows in mid-February 2009.&nbsp; It is a new project and is "growing organically" <strong><em>just like</em></strong> Sage-for-UNIX did.&nbsp;&nbsp; See <a href="http://windows.sagemath.org" target="_blank">http://windows.sagemath.org</a> for the project website.<br /></span></span></p>
<ul>
<li><span style="font-family: terminal,monaco;"><span style="font-family: times new roman,times;"><strong>Currently includes</strong>: </span></span>bzip2, cython, docutils, freetype, ipython, libpng, matplotlib, mercurial, m4ri, moin, mpir, networkx, ntl (as WinNTL), numpy, pycrypto, pyreadline, python, pywin32, scons, setuptools, sphinx (with dependencies: jinja2, pygments), sqlalchemy, sqlite, sympy, twisted, wexpect, zlib, zodb (with dependencies: zope.interface, zope.proxy, zope.testing, zconfig, and zdaemon).&nbsp;
<p>&nbsp;</p>
</li>
<li><strong>MS Visual Studio 2008</strong>: Everything currently builds from scratch on Windows XP or Windows Vista using MSVC 2008.
<p>&nbsp;</p>
</li>
<li><strong>Contributors so far</strong>:
<p>(1) Michael Abshoff (and I) did (and are doing) much work on getting Sage to build on <em><strong>Cygwin</strong></em>;</p>
<p>(2) Dan Shumow and I wrote a native build system using .bat files and got about half the components of Sage to build <strong>NATIVELY WITH MSVC.&nbsp; </strong></p>
<p>(3)<strong> </strong>Blair Sutton wrote a very nice new Python-based build system built on top of<em><strong> Python's distutils</strong></em>, then he <em><strong>ported scipy</strong></em> to MSVC 2008 (!).&nbsp;</p>
<p>Also, help from Tom Boothby, Chris Gorecki (pexpect), and William Cauchois.</p>
<p>&nbsp;</p>
</li>
<li><strong>Microsoft</strong> <strong>Research</strong> and <strong>Microsoft Incubation and Advanced Technologies</strong> both provided<strong> funding</strong>.
<p>&nbsp;</p>
</li>
<li><strong>Nontrivial hurdle:</strong> get the notebook with preparser <strong><em>ported</em></strong>, which will provide a the first totally free viable alternative to all the other existing Windows scientific Python distros (Enthought Tool Suite, Python(x,y), etc.).&nbsp; This will require genuine porting work, because the notebook makes numerous assumptions that don't hold on Windows (e.g, that path separators are /). <br />
<p>&nbsp;</p>
</li>
<li><strong>Cygwin/SFU: </strong>In parallel with the above, hopefully Michael Abshoff can get Sage to build and work in Cygwin. <br />
<p>&nbsp;</p>
</li>
<li><strong>REvolution</strong>: they did a contract with Microsoft, and recently announced a full native (64-bit) version of R for Windows.&nbsp;&nbsp; This is an inspiration to us, and also makes our work easier (we do not have to try to port R).<br />
<p>&nbsp;</p>
</li>
</ul>

{{{id=5|

///
}}}

<div id="cell_text_10" class="text_cell">
<h2><strong>eMPIRe -- Multiple Precision Integers and Rationals</strong></h2>
<p>This is a very "<strong>Microsoft friendly</strong>" fork of the GMP library, which Bill Hart started.</p>
<ul>
<li> Brian Gladman (an MPIR developer) provide <em><strong>excellent </strong></em>out of the box support for using MPIR on Microsoft Windows with Microsoft Visual Studio C++.&nbsp;</li>
<li>The license is LGPLv2+ (so <strong><em>not</em></strong> LGPLv3).&nbsp;</li>
<li>It is developed in a friendly and open manner, with regular releases, and an open SVN repository.&nbsp; Developers keep their own copyright.&nbsp;&nbsp; </li>
<li>An absolutely massive amount of work has gone into this fork; substantial parts of what was GMP have been rewritten.&nbsp;&nbsp; </li>
<li>A large motivation has been massively increasing raw performance -- amazingly, eMPIRe is twice as fast as it was when the project started just over a year ago. </li>
</ul>
</div>

{{{id=11|

///
}}}

{{{id=4|

///
}}}

<h2>More Details: What is in sage-windows and what isn't</h2>
<p>Components that are <strong>in sage-windows are highlighted.</strong>&nbsp;&nbsp; If you can get anything not in yellow to build natively under Windows, then you can help!</p>
<p>SCORE: <strong>31 done&nbsp;&nbsp; /&nbsp;&nbsp;&nbsp; 38 to go</strong></p>
<ul>
<li><a href="http://math-atlas.sourceforge.net/" target="_blank">ATLAS</a>: Automatically Tuned Linear Algebra      Software</li>
<li><a href="http://www.netlib.org/blas" target="_blank">BLAS</a>: Basic Fortan 77 linear algebra routines</li>
<li><span style="background-color: #ffff99;"><a href="http://www.bzip.org/" target="_blank">Bzip2</a>: High-quality data compressor</span></li>
<li><a href="http://www.ifor.math.ethz.ch/%7Efukuda/cdd_home" target="_blank">Cddlib</a>: Double Description Method      of Motzkin</li>
<li><a href="http://clisp.cons.org/" target="_blank">ECL</a>: Implementation of the Common Lisp language</li>
<li><a href="http://abel.ee.ucla.edu/cvxopt" target="_blank">CVXOPT</a>: Convex optimization, linear programming,      least squares, etc.</li>
<li><span style="background-color: #ffff99;"><a href="http://www.cython.org/" target="_blank">Cython</a>: C-Extensions for Python</span></li>
<li><span style="background-color: #ffff99;">Docutils<br /></span></li>
<li><a href="http://www.warwick.ac.uk/staff/J.E.Cremona/mwrank/index.html" target="_blank">mwrank</a>: mwrank is a      program for computing Mordell-Weil groups of elliptic curves over Q via 2-descent. Since      November 2007 mwrank has formed part of the eclib package which is included in Sage.</li>
<li><a href="http://www.netlib.org/f2c/" target="_blank">F2c</a>: Converts Fortran 77 to C code</li>
<li><a href="http://www.flintlib.org/" target="_blank">Flint</a>: Fast Library for Number Theory</li>
<li><a href="http://perso.ens-lyon.fr/damien.stehle/english.html#software" target="_blank">FpLLL</a>: Euclidian      lattice reduction</li>
<li><span style="background-color: #ffff99;"><a href="http://www.freetype.org/" target="_blank">FreeType</a>: A Free, High-Quality, and Portable Font      Engine</span></li>
<li><span style="background-color: #ffff99;"><a href="http://www.g95.org/" target="_blank">G95</a>: Open source Fortran 95 compiler</span></li>
<li><a href="http://www-groups.dcs.st-and.ac.uk/%7Egap/" target="_blank">GAP</a>: Groups, Algorithms,      Programming</li>
<li><a href="http://www.libgd.org/Main_Page" target="_blank">GD</a>: Dynamic graphics generation tool</li>
<li><a href="http://www.math.u-bordeaux.fr/%7Eliu/G2R/" target="_blank">Genus2reduction</a>: Curve data      computation</li>
<li><a href="http://www.math.tu-berlin.de/%7Ejensen/software/gfan/gfan.html" target="_blank">Gfan</a>: Gr&ouml;bner fans      and tropical varieties</li>
<li><a href="http://ljk.imag.fr/CASYS/LOGICIELS/givaro/" target="_blank">Givaro</a>: C++ library for arithmetic and      algebra</li>
<li><span style="background-color: #ffff99;">MPIR: Multiple Precision Integers and Rationals</span></li>
<li><a href="http://gforge.inria.fr/projects/ecm/" target="_blank">GMP-ECM</a>: Elliptic Curve Method for Integer      Factorization</li>
<li><a href="http://www.gnu.org/software/gnutls/" target="_blank">GNU TLS</a>: Secure networking</li>
<li><a href="http://www.gnu.org/software/gsl/" target="_blank">GSL</a>: Gnu Scientific Library</li>
<li><a href="http://www.math.union.edu/%7Edpvc/jsMath/" target="_blank">JsMath</a>: JavaScript implementation of      LaTeX</li>
<li><a href="http://www.cs.uwaterloo.ca/%7Ez4chen/iml.html" target="_blank">IML</a>: Integer Matrix Library</li>
<li><span style="background-color: #ffff99;"><a href="http://ipython.scipy.org/" target="_blank">IPython</a>: Interactive Python shell</span></li>
<li><span style="background-color: #ffff99;"><a href="http://www.netlib.org/lapack/" target="_blank">LAPACK</a>: Fortan 77 linear algebra library</span></li>
<li><a href="http://pmmac03.math.uwaterloo.ca/%7Emrubinst/L_function_public/CODE/" target="_blank">Lcalc</a>:      L-functions calculator</li>
<li><a href="http://directory.fsf.org/project/libgcrypt/" target="_blank">Libgcrypt</a>: General purpose      cryptographic library</li>
<li><a href="http://www.gnupg.org/related_software/libgpg-error/" target="_blank">Libgpg-error</a>: Common error      values for GnuPG components</li>
<li><span style="background-color: #ffff99;"><a href="http://www.libpng.org/pub/png/libpng.html" target="_blank">libpng</a>: Bitmap image support</span></li>
<li><a href="http://www.linalg.org/" target="_blank">Linbox</a>: C++ linear algebra library</li>
<li><span style="background-color: #ffff99;"><a href="http://m4ri.sagemath.org/" target="_blank">M4RI</a>: Linear Algebra over GF(2)</span></li>
<li><span style="background-color: #ffff99;"><a href="http://matplotlib.sourceforge.net/" target="_blank">Matplotlib</a>: Python plotting library</span></li>
<li><a href="http://maxima.sourceforge.net/" target="_blank">Maxima</a>: computer algebra system</li>
<li><span style="background-color: #ffff99;"><a href="http://www.selenic.com/mercurial/wiki/index.cgi" target="_blank">Mercurial</a>: Revision control      system<span style="color: #333333;">&nbsp;<span style="background-color: #ffffff;"> (NOTE: version in sage-windows doesn't actually work!)</span></span><br /></span></li>
<li><span style="background-color: #ffff99;"><a href="http://moinmoin.wikiwikiweb.de/" target="_blank">MoinMoin Wiki</a></span></li>
<li><a href="http://perso.ens-lyon.fr/nathalie.revol/software.html" target="_blank">MPFI</a>: Multiple Precision      Floating-point Interval library</li>
<li><a href="http://www.mpfr.org/" target="_blank">MPFR</a>: C library for multiple-precision floating-point      computations with correct rounding</li>
<li>ECLib: Cremona's Programs for Elliptic curves</li>
<li><span style="background-color: #ffff99;"><a href="https://networkx.lanl.gov/wiki" target="_blank">NetworkX</a>: Graph theory</span></li>
<li><span style="background-color: #ffff99;"><a href="http://www.shoup.net/ntl/" target="_blank">NTL</a>: Number theory C++ library</span></li>
<li><span style="background-color: #ffff99;"><a href="http://numpy.scipy.org/" target="_blank">Numpy</a>: Numerical linear algebra</span></li>
<li><a href="http://www.gnu.org/software/gnutls/" target="_blank">OpenCDK</a>: Open Crypto Development Kit</li>
<li><a href="http://hep.itp.tuwien.ac.at/%7Ekreuzer/CY/CYpalp.html" target="_blank">PALP</a>: A Package for Analyzing      Lattice Polytopes</li>
<li><a href="http://pari.math.u-bordeaux.fr/" target="_blank">PARI/GP</a>: Number theory calculator</li>
<li><span style="background-color: #ffff99;"><a href="http://pexpect.sourceforge.net/" target="_blank">Pexpect</a>: Pseudo-tty control for Python<span style="background-color: #ffffff;"> (NOTE: It doesn't actually work)</span><br /></span></li>
<li><a href="http://polybori.sourceforge.net/" target="_blank">PolyBoRi</a>: Polynomials Over Boolean Rings</li>
<li><span style="background-color: #ffff99;"><a href="http://www.amk.ca/python/code/crypto" target="_blank">PyCrypto</a>: Python Cryptography Toolkit</span></li>
<li><span style="background-color: #ffff99;"><a href="http://www.python.org/" target="_blank">Python</a>: Interpreted language</span></li>
<li><a href="http://www.r-project.org/" target="_blank">R</a>: Statistical Computing</li>
<li><span style="background-color: #ffff99;"><a href="http://cnswww.cns.cwru.edu/%7Echet/readline/rltop.html" target="_blank">Readline</a>: Line-editing</span></li>
<li><a href="http://rpy.sourceforge.net/" target="_blank">Rpy</a>: Python interface to R</li>
<li><span style="background-color: #ffff99;"><a href="http://www.scipy.org/" target="_blank">Scipy</a>: Python library for scientific computation</span></li>
<li><a href="http://www.singular.uni-kl.de/" target="_blank">Singular</a>: fast commutative and noncommutative      algebra</li>
<li><span style="background-color: #ffff99;"><a href="http://www.scons.org/" target="_blank">Scons</a>: Software construction tool</span></li>
<li><span style="background-color: #ffff99;">Sphinx: Python documentation system<br /></span></li>
<li><span style="background-color: #ffff99;"><a href="http://www.sqlite.org/" target="_blank">SQLite</a>: Relation database</span></li>
<li><span style="background-color: #ffff99;">SQLAlchemy: Python database interface</span></li>
<li><a href="http://www.maths.bris.ac.uk/%7Emamjw/" target="_blank">Sympow</a>: L-function calculator</li>
<li><a href="http://www.mathe2.uni-bayreuth.de/axel/symneu_engl.html" target="_blank">Symmetrica</a>: Representation      theory</li>
<li> <span style="background-color: #ffff99;"><a href="http://code.google.com/p/sympy/" target="_blank">Sympy</a>: Python library for symbolic computation </span> 
<ul>
<li><span style="background-color: #ffff99;"><a href="http://code.google.com/p/mpmath/" target="_blank">mpmath</a>: Mpmath is a pure-Python library for        multiprecision floating-point arithmetic.</span></li>
</ul>
</li>
<li><a href="http://jedi.ks.uiuc.edu/%7Ejohns/raytracer/" target="_blank">Tachyon</a>: lightweight 3d ray tracer</li>
<li><a href="http://www.catb.org/%7Eesr/terminfo/" target="_blank">Termcap</a>: Simplifies the process of writing      portable text mode applications</li>
<li><span style="background-color: #ffff99;"><a href="http://twistedmatrix.com/trac/" target="_blank">Twisted</a>: Python networking library</span></li>
<li><span style="background-color: #ffff99;"><a href="http://www.scipy.org/Weave" target="_blank">Weave</a>: Tools for including C/C++ code within Python</span></li>
<li><span style="background-color: #ffff99;"><a href="http://www.zlib.net/" target="_blank">Zlib</a>: Data compression library</span></li>
<li><span style="background-color: #ffff99;"><a href="http://www.zope.org/Wikis/ZODB/" target="_blank">ZODB</a>: Object-oriented database</span></li>
</ul>

{{{id=3|

///
}}}

<h2>Usage Demo</h2>
<ol>
<li>Start up Sage for Windows (via Parallels).</li>
<li>Compute a symbolic integral (via sympy).</li>
<li>Draw a plot (via matplotlib).</li>
<li>Compute a graph invariant (via networkx).</li>
</ol>

{{{id=2|

///
}}}

<h2>Demo</h2>

{{{id=1|

///
}}}

<h2>Plan</h2>
<ol>
<li>Make some more improvements to the build system to make it very friendly to create, play around with, and test spkg's (Blair Sutton). </li>
<li>Continue adding spkg's from the list of Sage components.&nbsp;&nbsp; There are <em><strong>still <span style="text-decoration: underline;">38 left to do</span></strong></em><span style="text-decoration: underline;"><em><strong>.</strong></em></span></li>
<li>Work on porting the notebook and pexpect.</li>
<li>Potentially difficult components: libSingular, GAP, mwrank, eclib, PALP, Symmetrica, Sympow.&nbsp;&nbsp; I bet all build with Cygwin or Mingw, at least.&nbsp;&nbsp; Investigate possibility to dynamically link libraries built with Cygwin with C++ programs built via MSVC (see <a href="http://cygwin.com/faq/faq.programming.html#faq.programming.msvs-mingw" target="_blank">this page and similar pages</a>). This could be relevant for Sympow or libSingular or mwrank.</li>
</ol>

{{{id=17|

///
}}}

<h2>Community</h2>
<ol>
<li><strong>SPD:</strong> Strongly encourage the SPD (=Source Python Distribution) guys -- Ondrej Certik, Prabhu R., and Brian Granger -- to get involved with sage-windows, by making our build system sufficiently flexible and supportive of their needs. </li>
<li><strong>Something useful</strong>: Get something truly useful <em><strong>out there</strong></em> ASAP, in order to recruit some more developers.</li>
<li>Get more <strong>UW students</strong> involved.</li>
</ol>
<p>Porting Sage to windows is an easy-to-parallelize project.&nbsp;&nbsp; A good way to get such people is to make an easy to use product that some people will find very useful.&nbsp;</p>

{{{id=16|

///
}}}

{{{id=15|

///
}}}

{{{id=0|

///
}}}