奇点图像在不同机器上的不同行为?

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 也很重要:奇点无法将 /sys 安装到映像中,因为它在主机服务器上不存在。那个特定的 python 错误似乎也特定于 windows 10。Singularity 目前不支持 windows,即使有 WSL2 的魔力。