Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setugid() error using matplotlib with apache and django

I'm using matplotlib in a Django app served through apache on Mac OS X 10.7.5 but I can't get it to plot a figure for me. I've imported import matplotlib.pyplot as plt, and the line in my view,

plt.plot(x, y)

(x and y are numpy arrays) is causing the 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 setugid() is, or how to make running it allowed for my app. My $MPLCONFIGDIR is set to /tmp/.mplconfig and apache as user _www has written a couple of empty directories to it, so that seems to be working OK. Can anyone give me a clue?

Update: if I

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

and set up a figure, subplot and axes (the whole caboodle), I can savefig() without an error... what extra permissions does pyplot need?

like image 279
xnx Avatar asked Nov 03 '22 06:11

xnx


1 Answers

Using the agg backend after importing matplotlib got rid of the setugid() error in a Flask app running under OS X Server in Sierra

import matplotlib as mpl

mpl.use('agg')
like image 76
Scott Lasley Avatar answered Nov 09 '22 13:11

Scott Lasley