Setugid () error using matplotlib with apache and django

I use matplotlib in a Django application, through apache in Mac OS X 10.7.5, but I cannot get it to draw a figure for me. I imported import matplotlib.pyplot as plt, and the line in my view,

plt.plot(x, y)

( xand yare numpy arrays) throws an error

2013-01-23 16:39:16.731 httpd[381:203] The application with bundle ID (null) is running setugid(), which is not allowed.

in my apache error_log. I'm afraid I don’t know what it is setugid(), or how to make it possible for my application. Mine is $MPLCONFIGDIRinstalled in /tmp/.mplconfigand apache, as user _www wrote a couple of empty directories, so it seems to be working fine. Can someone give me a hint?

Update: if i

from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure

and adjust the shape, subtitle and axis (whole caboodle), I can savefig () without errors ... what additional permissions do I need to use pyplot?

+5
source share
2 answers

Using agg-server after importing matplotlibgot rid of mistakes setugid()in Flask appworking under OS X ServerinSierra

import matplotlib as mpl

mpl.use('agg')
+1
source

You can also add the backend configuration globally for your system in ~/.matplotlib/matplotlibrc, for example:

backend: TkAgg

This will also solve your problem. If you don’t matplotlibrc, just create one.

0
source

All Articles