我试图构建一个singularity容器,在基于centos7的集群上运行Python脚本。 容器在我的主机上按预期运行,我也使用它来创建容器,但是一旦导入PyTorch,它就会在集群上失败。你知道吗
这个问题可以通过从这个最小定义文件生成的容器来重现:
调试.def:
Bootstrap: arch
%runscript
exec /usr/bin/python3 -c 'import torch; print(torch.__version__)'
%post
#--------------------------------------------------------------------------
# Basic setup from
# https://github.com/sylabs/singularity/blob/master/examples/arch/Singularity
#--------------------------------------------------------------------------
# Set time zone. Use whatever you prefer instead of UTC.
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# Set the package mirror server(s). This is only for the output image's
# mirrorlist. `pacstrap' can only use your hosts's package mirrors.
echo 'Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch' > /etc/pacman.d/mirrorlist
pacman -Sy --noconfirm gawk sed grep
# Set locale. Use whatever you prefer instead of en_US.
echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen
locale-gen
echo 'LANG=en_US.UTF-8' > /etc/locale.conf
pacman -S --noconfirm python python-pytorch
pacman -S --noconfirm pacman-contrib
paccache -r -k0
它是用sudo singularity build debug.sif debug.def
构建的。
容器和主机都运行在Arch Linux上。你知道吗
在我的主机上执行容器将输出PyTorch版本:
schellsn@host $ singularity run debug.sif
1.3.1
在群集上运行它会导致以下错误:
schellsn@cluster tmp$ singularity run debug.sif
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/torch/__init__.py", line 81, in <module>
from torch._C import *
ImportError: libQt5Core.so.5: cannot open shared object file: No such file or directory
我不明白为什么找不到该文件,因为它应该包含在容器中:
schellsn@cluster tmp$ singularity shell debug.sif
Singularity debug.sif:~/tmp> ls -l /usr/lib | grep libQt5Core
-rw-r--r-- 1 root root 1166 Nov 11 23:40 libQt5Core.prl
lrwxrwxrwx 1 root root 20 Nov 11 23:40 libQt5Core.so -> libQt5Core.so.5.13.2
lrwxrwxrwx 1 root root 20 Nov 11 23:40 libQt5Core.so.5 -> libQt5Core.so.5.13.2
lrwxrwxrwx 1 root root 20 Nov 11 23:40 libQt5Core.so.5.13 -> libQt5Core.so.5.13.2
-rwxr-xr-x 1 root root 5275240 Nov 11 23:40 libQt5Core.so.5.13.2
我假设导入时搜索中不包含相应的路径,并且由于某些环境设置正在泄漏到容器中,所以在我的主机上不会出现此问题。 我也尝试过使用Sylabs远程构建器,但它似乎无法构建Arch容器(pacstrap未在$PATH中找到)。 尝试在其中一个节点上构建容器会导致相同的问题;Pacstrap和pacman不可用。你知道吗
我已经不知所措了,如果能给我任何解释这种行为的暗示,我将不胜感激! 为什么找不到共享库?如何修复?你知道吗
更新#1:
下面是LD\u LIBRARY\u PATH环境变量的内容(响应@tsnowlan)。你知道吗
Arch Linux主机:
schellsn@host tmp$ echo $LD_LIBRARY_PATH
:/usr/local/cuda/lib:/usr/local/cuda/lib64:/usr/local/cuda/lib:/usr/local/cuda/lib64
schellsn@host tmp$ singularity shell evpt_debug.sif
Singularity evpt_debug.sif: ~/tmp> echo $LD_LIBRARY_PATH
:/usr/local/cuda/lib:/usr/local/cuda/lib64:/usr/local/cuda/lib:/usr/local/cuda/lib64:/.singularity.d/libs
CentOS 7群集节点:
schellsn@cluster tmp$ echo $LD_LIBRARY_PATH
schellsn@cluster tmp$ singularity shell debug.sif
Singularity debug.sif:~/tmp> echo $LD_LIBRARY_PATH
/.singularity.d/libs
更新#2:
我确实设置了一个新的干净的VM(也运行arch),它还可以在那里创建和重建容器。此容器显示了相同的问题;它在我的主机上运行,但在CentOS 7群集上不运行。你知道吗
作为一种解决方法,我现在从一个def文件构建容器,该文件使用带有ubuntu18.04映像的library bootstrap代理,而不是Arch bootstrap代理。 生成的容器在我的Arch主机和centos7集群上运行。你知道吗
相关问题 更多 >
编程相关推荐