UserWarning: el módulo matplotlib ya se importó

I get the following warning whenever running a script:

/usr/lib/pymodules/python2.6/mpl_toolkits/ UserWarning: Module matplotlib was already imported from /usr/local/lib/python2.6/dist-packages/matplotlib/__init__.pyc, but /usr/lib/pymodules/python2.6 is being added to sys.path

Here is the imports section of the script:

from __future__ import division
import csv
from datetime import datetime, timedelta
from random import random
import numpy as np
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as Canvas
from import candlestick, plot_day_summary
from matplotlib.ticker import FuncFormatter
from matplotlib.patches import Circle, Rectangle
from matplotlib.lines import Line2D
from mpl_toolkits.axes_grid import make_axes_locatable
from mpl_toolkits.axes_grid.axes_size import AxesY
from matplotlib.font_manager import FontProperties
from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
from matplotlib import rcParams

What is causing the warning?

preguntado el 09 de marzo de 12 a las 13:03

I get a similar error when running your code, except that it is complaining about the module readline already being imported. The line which was causing troubles was from mpl_toolkits.axes_grid import make_axes_locatable -

1 Respuestas

The "problem" is with your installation of matplotlib - or rather, your two installations of it - not with the program you're trying to run.

From the message, I can infer that you have one version of matplotlib installed in /usr/local - perhaps a newer version that you installed yourself without using OS package management? - and another version in the OS standard location, /usr/lib/pymodules/python2.6.

The warning message tells you that Python notado the OS packaged version, but it is going to ignore it (ie, not load any modules from it) because it ya haya utilizado found the version in /usr/local and it can't make sense of having modules from two different directories.

If you meant to have two versions and you meant to be using the version in /usr/local, then the warning is essentially harmless to you.

If you didn't realize you have two versions of matplotlib installed, you might want to try to clean up that situation a bit.

respondido 09 mar '12, 15:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.