yash_wardhan_chauhan
yash_wardhan_chauhan

Reputation: 141

Matplotlib created a temporary config/cache directory

Matplotlib created a temporary config/cache directory at /var/www/.config/matplotlib because the default path (/tmp/matplotlib-b33qbx_v) is not a writable directory; it is highly recommended to set the MPLCONFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.

This is the message I'm getting in error.log file and 504 Gateway Time out error on browser . Someone please help to resolve this issue.

Upvotes: 13

Views: 27400

Answers (2)

Dnaaz
Dnaaz

Reputation: 195

import os os.environ['MPLCONFIGDIR'] = os.getcwd() + "/configs/"

before

import matplotlib

works for me

Upvotes: 9

Peter TechNerd
Peter TechNerd

Reputation: 71

Please check: https://github.com/pyinstaller/pyinstaller/issues/617

I run matplotlib from the webserver and use: os.environ['MPLCONFIGDIR'] = '/opt/myapplication/.config/matplotlib' This dir should writable by the web server (e.g. www-data).

Upvotes: 7

Related Questions