![](/img/trans.png)
[英]same python source code on two different machines yield different behavior
[英]Different behavior of Singularity image on different machines?
我尝试在远程机器上运行基于 python3 的 Singularity 图像,但出现以下错误,而其他机器则没有:
singularity exec --nv --no-home --bind data/:/data/ image/ scripts/train.sh
+ singularity exec --nv --no-home --bind data/:/data/ image/ scripts/train.sh
WARNING: skipping mount of sysfs: no such file or directory
scripts/train.sh: line 8: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8): No such file or directory
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = '/usr/local/bin/python'
program name = '/usr/local/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/usr/local/bin/python'
sys.base_prefix = '/usr/local'
sys.base_exec_prefix = '/usr/local'
sys.executable = '/usr/local/bin/python'
sys.prefix = '/usr/local'
sys.exec_prefix = '/usr/local'
sys.path = [
'/usr/local/bin/python',
'/usr/local/lib/python38.zip',
'/usr/local/lib/python3.8',
'/usr/local/lib/python3.8/lib-dynload',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: no codec search functions registered: can't find encoding
Current thread 0x00007f628ee51740 (most recent call first):
<no Python frame>
我的定义文件如下所示:
Bootstrap: docker
From: python:3
%post
apt-get update -y
apt-get install -y git
pip install torch torchvision
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --no-cache-dir ./
%runscript
echo "Running nnunet container..."
我该如何解决这个错误? 为什么图像在不同机器上的表现不同?
这通常是由于环境变量在没有注意到的情况下被传递或不传递给容器。 为确保这不是问题,您可以使用-e
或--cleanenv
。 这将防止任何未以SINGULARITYENV_
为前缀的变量加载到容器中。
也就是说,警告WARNING: skipping mount of sysfs: no such file or directory
也涉及:singularity 无法将/sys
挂载到映像中,因为它不存在于主机服务器上。 那个特定的 python 错误似乎也特定于 Windows 10。即使有 WSL2 的魔力,Singularity 目前也不支持 Windows。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.