1

Am new to progamming and Python, i keep getting the error below when i run my program. Someone advised i should use pip to solve it. But cant pip get installed using the cmd. Though i suceeded using Powershell but still cant make it work. How do i solve this, any tips will go along way. Thanks

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from satmc import satmc
  File "C:\Python27\starb_models_grid1\satmc.py", line 3, in <module>
    import matplotlib.pyplot as plt
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 110, in <module>
    raise ImportError("matplotlib requires dateutil")
ImportError: matplotlib requires dateutil

Am using version 2.7.3

Lily Mara
  • 3,859
  • 4
  • 29
  • 48
user3478205
  • 11
  • 1
  • 1
  • 3
  • $ sudo pip install python-dateutil ( It's duplicate with http://stackoverflow.com/questions/18280436/importerror-matplotlib-requires-dateutil ) – Nianliang May 31 '14 at 10:47

4 Answers4

2

You need to install various packages to get numpy working correctly.

  1. libsvm-3.17.win32-py2.7
  2. pyparsing-2.0.1.win32-py2.7
  3. python-dateutil-2.2.win32-py2.7
  4. pytz-2013.9.win32-py2.7
  5. six-1.5.2.win32-py2.7
  6. scipy-0.13.3.win32-py2.7
  7. numpy-MKL-1.8.0.win32-py2.7
  8. Matplotlib

Download all the binaries from this link and install and then you will have a working numpy installation.

ajknzhol
  • 6,322
  • 13
  • 45
  • 72
2

You're probably looking for:

pip install python-dateutil
David Wolever
  • 148,955
  • 89
  • 346
  • 502
1

The error states that you are missing Dateutil.

This could mean that you did not install Dateutil with pip install python-dateutil or your way to install Python modules. But if you did your pip install and still get the same error it could also mean that DateUtil is installed in a folder where your Python distribution does not expect it.

In my case (Mac OSX) I installed pip with Brew http://brew.sh/. That pip will install the modules in: /usr/local/lib/python2.7/site-packages/

However the standard Mac OSX Python distribution will look for modules in /Library/Python/2.7/site-packages/

Your folders could be different of course, but you can check where Python looks for modules with:

import sys
print sys.path

Check this and see if one of the directories in the list contains the directory where dateutil is installed. If not add a PYTHONPATH environment variable: Like: PYTHONPATH=/usr/local/lib/python2.7/site-packages/ or the folder where your dateutil is installed

Pullie
  • 2,685
  • 3
  • 25
  • 31
0

I did pip install python-dateutil, but kept getting the same error. I got past that error by installing from http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-dateutil Look for the Matplotlib section and install the dependencies you don't have. Matplotlib is a 2D plotting library. Requires numpy, dateutil, pytz, pyparsing, six, setuptools, and optionally pillow, pycairo, tornado, wxpython, pyside, pyqt4, ghostscript, miktex, ffmpeg, mencoder, avconv, or imagemagick.

Jim Smith
  • 457
  • 5
  • 9