【发布时间】:2021-01-04 04:08:58
【问题描述】:
我在通过 ssh 连接到 Linux 集群时运行 Julia 脚本。代码加载 matplotlib 如下:
import Distributed
using Distributed
@everywhere pushfirst!(Base.DEPOT_PATH,"/tmp/test.cache")
@everywhere import PyCall
@everywhere import PyPlot
@everywhere pyimport matplotlib.pyplot as mpl
当我从终端运行它时,我的代码运行良好。但是,当我通过 Torque 提交作业时,输出文件 can be found here, and appears to suggest that the code cannot find matplotlib.
我对上面的内容有点困惑。为什么我在终端运行代码可以正常运行,但是提交PBS文件就不行了?为什么找不到matplotlib?它使用 usr/bin/ 中的 python,我相信这是我的默认 python。我试过运行 pip,但它说 matplotlib 已更新。在尝试导入 matplotlib 之前,我还导入了其他包(如 numpy 和 datetime),并且没有错误。当我在集群的终端中运行 Julia 并调用 PyCall,然后运行
julia> @pyimport matplotlib
它加载完全正常。我做错了什么?
一个相关的问题(我的 .pbs 文件)可以是found here: Module FixedPointNumbers missing from the cache when running Julia on cluster 。
编辑:一件事是当我在 ssh 进入集群时正常运行 Julia(即,只是在终端中,而不是通过提交 .pbs 文件),我得到了错误
Warning: No working GUI backend found for matplotlib
这是否会导致我在提交作业时遇到问题?
【问题讨论】:
-
通常,集群上的作业文件不会加载 bashrc(或类似文件)。因此,也许您在常规终端中加载了某个 python 版本,您必须在作业文件中显式加载。例如通过
module load pythonXY。只是一个想法。 -
@crstnbr 我试过编写模块加载 python,但不幸的是这似乎不起作用。我也安装了 python3,但这不是 Julia 调用的 python 版本。
标签: matplotlib julia cluster-computing torque