Vera
Vera

Reputation: 31

Trouble with importing matplotlib

I have a trouble while importing matplotlib in PyCharm4.5.3

from pylab import *`

Error:

Traceback (most recent call last):
  File "/home/vera/PycharmProjects/COM/backend/17.08", line 10, in <module>

    from pylab import *

  File "/usr/lib/python3/dist-packages/pylab.py", line 1, in <module>

from matplotlib.pylab import *

  File "/usr/lib/python3/dist-packages/matplotlib/pylab.py", line 226, in <module>

import matplotlib.finance

  File "/usr/lib/python3/dist-packages/matplotlib/finance.py", line 21, in <module>

from matplotlib.dates import date2num

  File "/usr/lib/python3/dist-packages/matplotlib/dates.py", line 119, in <module>


     from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY,
      File "/usr/lib/python3/dist-packages/dateutil/rrule.py", line 55
        raise ValueError, "Can't create weekday with n == 0"
                    ^
SyntaxError: invalid syntax

Process finished with exit code 1

It was working before I installed PyCharm Community Edition. In professional edition it worked. But after installation the programm broked even in PyCharm professional Edition.

What i did wrong?

Upvotes: 3

Views: 3408

Answers (3)

I had the same problem and solved it reinstalling the python-dateutil library:

pip3 uninstall python-dateutil
pip3 install python-dateutil

Upvotes: 0

Saurabh Saini
Saurabh Saini

Reputation: 196

I also had the same problem while using matplotlib in anaconda virtual environment. Updating the dateutil lib to the latest version worked for me :

pip install python-dateutil --upgrade

Hope this helps.

Upvotes: 8

Roland Smith
Roland Smith

Reputation: 43495

The file rrule.py from the dateutil module uses old (invalid) syntax to raise an exception.

Maybe you installed an old version of dateutil?

Upvotes: 2

Related Questions