14

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.

2 Answers 2

9

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

before

import matplotlib

works for me

Sign up to request clarification or add additional context in comments.

1 Comment

it works for me but make them in two lines import os os.environ['MPLCONFIGDIR'] = os.getcwd() + "/configs/"
7

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).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.