Friday, August 17, 2012

Fix ImportError: No module named dateutil.rrule error in MAC 10.8 with Python 2.7.3


When I try to execute python code with import matplotlib, I received following errors:


Traceback (most recent call last):
  File "plotPRREachNode.py", line 6, in
    import matplotlib.pyplot as pl
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/pyplot.py", line 26, in
    from matplotlib.figure import Figure, figaspect
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/figure.py", line 19, in
    from axes import Axes, SubplotBase, subplot_class_factory
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/axes.py", line 19, in
    import matplotlib.dates as mdates
  File "/Library/Python/2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.8-intel.egg/matplotlib/dates.py", line 122, in
    from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \
ImportError: No module named dateutil.rrule


The method to solve this error is go to http://labix.org/python-dateutil/#head-2f49784d6b27bae60cde1cff6a535663cf87497b and download the python-dateutil-1.5.tar.gz 

Then untar the file and type in command line:
python setup.py install



That's it, wish this could help.


Tuesday, August 14, 2012

EASY Install matplotlib on mac ox 10.8



  1. Get Xcode 4.3.2, it's required for some of the later steps.
  2. Download the latest version of python for OSX from python.org
  3. Grab the Scipy superpack.
  4. Uninstall any previous versions of numpy/matplotlib/scipy that you currently have. That includes doing cd /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/ and moving any numpy/matplotlib/scipy directories or eggs into a temp directory.
  5. cd ~/Downloads(or wherever you downloaded the superpack script to) and run sh install_superpack.shAnswer no to the question are you installing from a repository cloned to this machine or you'll be confused about why the script keeps failing.
That should be it! You should now be able to boot up the python console and import numpy, scipy, matplotlib.
share|improve this answer




source:  http://fonnesbeck.github.com/ScipySuperpack/


Alternately, if you have curl installed, you can get the script via:
$ curl -o install_superpack.sh 
https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
To install, open a terminal in the directory that the script is located and call:
$ sh install_superpack.sh
You will be prompted for your administrator password. If you have already installed the current gFortran, you can bypass that package during the install process. Similarly, the installation requires Git, so you will be prompted to install it if you are installing remotely.