Michał Górecki
Michał Górecki

Reputation: 31

Error while importing matplotlib in Canopy - rc_params_from_file()

I have the Enthought Canopy installed on my Ubuntu 14.04. I'm trying to run sample matplotlib programs (from the library's website). Every attempt of running the program makes the Canopy's command prompt display following message:

TypeError                                 Traceback (most recent call last)
/home/guras/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
    202             else:
    203                 filename = fname
--> 204             __builtin__.execfile(filename, *where)

/home/guras/Python programy/pierwszy.py in <module>()
      4 This example uses the Fahrenheit and Celsius scales.
      5 """
----> 6 import matplotlib.pyplot as plt
      7 import numpy as np
      8 

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>()
     26 import matplotlib
     27 import matplotlib.colorbar
---> 28 from matplotlib import style
     29 from matplotlib import _pylab_helpers, interactive
     30 from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/__init__.py in <module>()
      1 from __future__ import absolute_import
      2 
----> 3 from .core import use, context, available, library, reload_library

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in <module>()
    147 # Load style library
    148 # ==================
--> 149 _base_library = load_base_library()
    150 
    151 library = None

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in load_base_library()
     92     """Load style library defined in this package."""
     93     library = dict()
---> 94     library.update(read_style_directory(BASE_LIBRARY_PATH))
     95     return library
     96 

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in read_style_directory(style_dir)
    125     styles = dict()
    126     for path, name in iter_style_files(style_dir):
--> 127         styles[name] = rc_params_from_file(path, use_default_template=False)
    128     return styles
    129 

TypeError: **rc_params_from_file() got an unexpected keyword argument 'use_default_template'** 

Any ideas how to fix it?

Upvotes: 1

Views: 784

Answers (2)

Jonathan March
Jonathan March

Reputation: 5810

Use the Canopy Package Manager to update matplotlib to the latest version.

Upvotes: 0

unutbu
unutbu

Reputation: 879621

The use_default_template keyword parameter was added to the rc_params_from_file function in matplotlib version 1.4.0rc1.

Most likely, your version of matplotlib is older than 1.4.0rc1 and needs to be upgraded.


If you have more than one installation of matplotlib installed, you'll need to make sure the directory containing the newer version is listed earlier than the older version in sys.path, or perhaps, simply delete the older version of matplotlib.

Upvotes: 1

Related Questions