Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matplotlib error due to missing environment variables #73

Open
tecnologia-acceleralia opened this issue Apr 15, 2024 · 1 comment
Open

Comments

@tecnologia-acceleralia
Copy link

Hello,

first, I'm not sure if this is the correct place to ask for this. I'm trying to use matplotlib with CodeRunner in Moodle connecting to a Jobe server hosted in Digital Ocean. Simple scripts with python3 work well but if I try to use matplotlib I get this error:

SCRIPT:

import matplotlib.pyplot as plt
import numpy as np

# Aquí el estudiante escribe su código para generar el gráfico
x = np.arange(5)
y = np.random.randint(1, 10, size=5)
plt.bar(x, y)
plt.xlabel('Eje X')
plt.ylabel('Eje Y')
plt.title('Gráfico de barras')
plt.show()

OUTPUT:

Error in question
Bad output from grader: 
Run result: Error
Output: 
{"fraction": 1.0, "epiloguehtml": "<img src=\"data:image/png;base64,iVBORw0KGgoAAAANSU ..... \" alt=\"Gr\u00e1fico de barras\">"}

Matplotlib created a temporary config/cache directory at /tmp/matplotlib-b49jl89b because the default path (/home/jobe00/.cache/matplotlib) 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.
. Your program execution may have aborted (e.g. a timeout or memory limit exceeded).

I've tryed to configure the environment variables for "jobe" user in the jobe server but the user used to execute the job in the server does not get these values.

Username: jobe00
matplotlib uses /home/jobe00/.config/matplotlib
MPLCONFIGDIR None
MATPLOTLIBRC None
XDG_CONFIG_HOME None
MATPLOTLIBDATA None

How can I resolve that?

Thanks!

@trampgeek
Copy link
Owner

trampgeek commented Apr 18, 2024

Please see trampgeek/jobeinabox#13 and https://coderunner.org.nz/mod/forum/discuss.php?d=384

The issue should, I admit, be fixed in Jobe itself. There's a fix at the end of the second thread that I don't seem to have implemented in Jobe yet. Will do so now and it will appear on the next Jobe update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants