Tuesday, September 08, 2009

[SW] Python+SciPy+Matplotlib (installation and test)

There are many ways to use open source software and libraries to accomplish works which have been done by using Matlab. Oactve and Scilab might be two of the most well-known choices. Actually, my works don't need them very often and hence I don't know them well.

When I was reading some discussions about which one is ``better'' (okay, I know this question might be a stupid one), there are many information indicate that Python+SciPy+Matplotlib is a good combination to replace MATLAB. What I knew was Python, which occupied my weekend days to play around with. SciPy and matplotlib were new to me. I never heard about them but some screenshots showing their working results impressed me very much, so I decide to give them a try.

But it cost me more time than I expected. Orz (It's my own fault, not matplotlib's)

At the beginning, I installed the python-scipy, python-numpy and python-matplotlib via Synaptic Package Manager, and everything went smoothly. I just downloaded the examples and use python to see the plots. Good quality! And many formats including eps are available. When I tried to see the result given by a downloaded example (path_patch_demo.py), however, the python interpreter feedbacked error message said there was no so-called ``path'' module. I spent several minutes to figure out that the problem might caused by the version of my installations.

The newest version of the matplotlib is 0.99, and the one installed by Ubuntu was... 0.91.2! So I began to download newest version of matplotlib, SciPy and Numarray (Later, I found what I want to download is NumPy ,not Numarray, which is not supported anymore). Then, I followed the INSTALL files of the packages to find more other necessary packages. During the installation, I didn't follow all the instructions carefully and miss the libpng before installing the mataplotlib. Due to the mistake, the python interpreter said it cannot find TkAgg even the python-tk and tk8.4 have been installed (I'm not sure which one could be related to this problem).

Finally, I got new versions of the necessary libraries and can apply the examples with no problem.

Wow, it costed me several hours, but it's worth it because I learned more during the installing process.

---
Notes:
/usr/lib/python2.5/site-packages/matplotlib
/usr/lib/python2.5/site-packages/scipy
/usr/lib/python2.5/site-packages/numpy
Backend setting:
/usr/lib/python2.5/site-packages/matplotlib/mpl-data/matplotlibrc

No comments:

Post a Comment