Installing python

From Python Wiki

Jump to: navigation, search

This page lists a number of different distribution packages for Python:

Various versions of Python may be downloaded from the python.org/downloads page. However, the real trick to using Python for engineering work is the use of various packages including numpy, scipy and matplotlib at a minimum, along with some kind of Integrated Development Environment (IDE). These are typically included with a variety of distributions of Python, some of which are listed below. In most cases you download the distribution, run the installer and you have an integrated package, including one or more IDEs.

PLEASE ADD COMMENTS ON DISTRIBUTIONS LISTED HERE OR OTHERS THAT MIGHT BE OF INTEREST


Contents

Anaconda Distribution

An excellent option for installing a full Python distribution is Anaconda. This seems to satisfy the need for a free, easily installed 64-bit Python with all the bells and whistles an engineer or scientist might want. In particular, as well as the standard numpy/scipy/matplotlib stack it comes with a long list of packages and with the same Spyder IDE that Python(x,y) comes with. It also has installers for Linux, Windows and Mac, while python(x,y) is Windows only. I tested its numerical performance on some large linear algebra calculations (eigenvalues, linear solutions, svd's) against Matlab and it was a bit faster (10-20% faster). It turns out that that's because the current version is compiled with the Intel Math Kernel Library (MKL). I had a conversation with a developer who warned me that they might not always be able to offer the MKL version for free, and we might need to pay $29 at some point. However, for the time being MKL is in the free version of the product, and performance is excellent.

Installing other Python packages is also fairly straight forward. If the package comes with a Windows installer make sure that you're getting the 64-bit version. I had no trouble installing the latest version of pandas and pywavelets. I was also able to install pyNastran, which installs with a Python setup script.

The company that develops Anaconda recently won a $3 million grant from Darpa to "develop NumPy, SciPy and visualization techniques for the interactive exploration of large, multi-dimensional data sets."

There are Python 2.6, 2.7 and 3.3 versions of Anaconda. Though you might be inclined to install the 3.3 version (why wouldn't you want the latest?), it turns out that many of the packages (including Spyder) haven't yet been ported to 3.3 so it's a much shorter list. As of the writing of this entry (4/29/2013) you should probably stick to 2.7.

The one warning that I'll give is that the Anaconda website says that you should be able to install it over existing versions of Python. I found that when I first installed it Spyder didn't work correctly because it was apparently getting confused between my Anaconda 64-bit installation of Python 2.7.3 and the python(x,y) 32-bit installation. I uninstalled python(x,y) and those problems went away. So I would recommend uninstalling existing versions of Python before installing Anaconda.

In summary, Anaconda seems to have everything that a scientist or engineer might want in a full flavored, easily installed 64-bit version of Python. I think that 64-bit is essential for heavy duty computing, so this is great news.

Python(x,y) Distribution

There are a number of Python distributions that come with the desired scientific/engineering packages, but one of the best for the purposes of engineering work may be python(x,y). This distribution is specifically oriented towards the needs of scientists and engineers, includes all the packages you are likely to need in one nice installer and also includes an integrated development environment (IDE) tool called Spyder, which provides a very nice way of interacting with Python, particularly for those used to working with Matlab. It's also free. Python(x,y) also comes with other IDE's including Eclipse with pydev, which is an excellent tool for larger code development projects.

Note that python(x,y) is 32-bit. If you want a 64-bit version with a slightly shorter list of included packages you should try Anaconda (see above)

Spyder has been successfully run under some Windows 7 64-bit PCs, but has failed under others for unknown reasons.

An alternative IDE which may be more platform-robust is PyCharm. This is a commercial IDE for a reasonable fee.


One drawback to python(x,y) is that it is currently only distributed for Windows, though you can download the components (including Spyder) individually on Linux. Another downside to python(x,y) is that it currently only provides a 32-bit version of the code, though this is fine for most purposes and there are plans to release a 64-bit version by the end of Q3-2011. MacOS users can install Spyder 2.x on Mac OS X with 64bit Python using MacPorts.

One of the few packages that doesn't install with python(x,y) is scitools. This sits on top of numpy, scipy and matplotlib, and includes easyviz, a unified interface to multiple Python plotting packages to provide a simple Matlab like plotting capability. While this does not come with the python(x,y) distribution, but is easily downloaded and installed. I (Paul) had no problem installing it on top of my python(x,y) distribution, but haven't used it much. It was recommended in a book I have called A Primer on Scientific Programming with Python by Hans Petter Langtangen. Not surprisingly Dr. Langtangen is also one of the authors of scitools.

Enthought Python Distribution (EPD)

Another excellent Python distribution for scientists and engineers is the Enthought Python Distribution (EPD) It's available for a reasonable fee ($199 for a single user). EPD includes both 32-bit and 64-bit implementations for all platforms and I understand that they're machine optimized to run on multiple cores. This may be the best choice for serious numerical performance.

Note that Enthought is the maintainer of the scipy package, and provides lots of Python related services.

WinPython

WinPython is a a free, open-source, portable scientific Python 2/3 32/64bit distribution for Windows. It includes the Spyder IDE, NumPy, SciPy, Matplotlib, guiqwt, etc.

SAGE

SAGE is another intriguing distribution built on Python that allows you to interact in a notebook interface, much like Mathematica. In fact it's designed as a replacement for the four M's (Magma, Maple, Mathematica and Matlab), and their mission statement is Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab. In particular it adds symbolic manipulation (Magma, Maple and Mathematica) type capabilities to the already powerful numerical linear algebra capabilities of Python, and packages it all in a uniform notebook interface that runs in a web browser. Unfortunately there isn't yet a native port for Windows and the Windows installation requires that you first install a Virtual Machine to run Linux and then import SAGE into the Virtual Machine. It didn't work for me (Paul) out of the box, and for now I've given up on it. I might try it on my Linux box at home if I get a chance, but it's probably worth waiting for a native Windows port before trying it there.


Installing Modules

Here's some documentation on installing Python modules that covers the standard case of a Distutils installation. This is supposed to the standard way that modules are installed starting in Python 2.6, but it doesn't appear to be all that standard.


Linux Installation

See Linux Installation


Cygwin Installation

The full Cygwin installation includes Python and Numpy. It does not include Scipy or Matplotlib, however.

There does not appear to be a method for readily installing Scipy in Cygwin.

Matplotlib can be reportedly installed, but heavy-duty troubleshooting is required.



Return to: Main Page | Vibrationdata Python Scripts

Personal tools