I am running a Julia script while ssh'ed into a Linux cluster. The code loads matplotlib as the following:
import Distributed
using Distributed
@everywhere pushfirst!(Base.DEPOT_PATH,"/tmp/test.cache")
@everywhere import PyCall
@everywhere import PyPlot
@everywhere pyimport matplotlib.pyplot as mpl
My code works fine when I run it from the terminal. However, when I submit the job via Torque, the out file can be found here, and appears to suggest that the code cannot find matplotlib.
I'm a little confused by the above. Why does the code run normally when I run it in the terminal, but won't work if I submit a PBS file? Why can't it find matplotlib? It's using the python found in usr/bin/, which I believe is my default python. I've tried running pip, but it says matplotlib is updated. I've also imported other packages (like numpy and datetime) before I tried importing matplotlib, and there was no error. When I run Julia in terminal on the cluster and call PyCall, and then run
julia> @pyimport matplotlib
It loads completely fine. What am I doing wrong?
A related question (with my .pbs file) can be found here: Module FixedPointNumbers missing from the cache when running Julia on cluster
.
EDIT: The one thing is that when I run Julia normally while ssh'ed into the cluster (i.e., just in the terminal, not by submitting the .pbs file), I get the error
Warning: No working GUI backend found for matplotlib
Could this result in the issue I'm having when submitting the job?
question from:
https://stackoverflow.com/questions/65557577/matplotlib-not-found-when-trying-to-run-code-in-linux-cluster 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…