Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 298
yash_wardhan_chauhan Avatar asked Feb 10 '26 19:02

yash_wardhan_chauhan


1 Answers

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

before

import matplotlib

works for me

like image 156
Dnaaz Avatar answered Feb 13 '26 15:02

Dnaaz