在 ARM Mac 上的 Docker 容器中运行 Micromamba 安装时卡住了。

huangapple go评论106阅读模式
英文:

Micromamba install gets stuck when run in docker container on ARM mac

问题

在运行于 M1 ARM macOS 13.5 上的 amd64 Docker 容器中使用 micromamba install 命令时,在解压步骤之后,安装过程会无限期地挂起。

以下是使用以下命令构建的 Dockerfile:

docker build . --platform linux/amd64
FROM mambaorg/micromamba:1.4.9
COPY environment.yml /environment.yml
RUN micromamba create -vv -y -n pangolin -f /environment.yml
...
#7 20.14   Install: 117 packages
#7 20.14 
#7 20.14   Total download: 192MB
─────────────────────────────────────────────────────────────────────────────────────────
#7 20.14 Transaction starting

在信息日志中,可以看到更多详细信息(因为是新的运行,所以时间不同):

#7 21.54 info     libmamba Transfer done for 'coin-or-clp'
#7 21.54 info     libmamba Transfer finalized, status: 200 [https://conda.anaconda.org/conda-forge/linux-64/coin-or-clp-1.17.8-h1ee7a9c_0.conda] 1173622 bytes
#7 21.54 info     libmamba Download finished, validating '/opt/conda/pkgs/coin-or-clp-1.17.8-h1ee7a9c_0.conda'

这是调试日志中发生的情况(再次运行,因此忽略相对时间):

#7 28.93 debug    libmamba Running in-process extraction for '/opt/conda/pkgs/git-lfs-3.4.0-ha770c72_0.conda'
#7 29.03 debug    libmamba Extracted to '/opt/conda/pkgs/mpi-1.0-openmpi'
#7 29.03 debug    libmamba Decompressing '/opt/conda/pkgs/connection_pool-0.0.3-pyhd3deb0d_0.tar.bz2'
#7 29.03 debug    libmamba Running subprocess extraction '/bin/micromamba package extract /opt/conda/pkgs/connection_pool-0.0.3-pyhd3deb0d_0.tar.bz2 /opt/conda/pkgs/connection_pool-0.0.3-pyhd3deb0d_0'

在此之后没有任何进展,即使等待了10分钟。我该如何解决这个问题?

英文:

When using micromamba install in an amd64 docker container run on M1 ARM macOS 13.5, the installation hangs indefinitely after the extraction step.

The following docker file, built with

docker build . --platform linux/amd64
FROM mambaorg/micromamba:1.4.9
COPY environment.yml /environment.yml
RUN micromamba create -vv -y -n pangolin -f /environment.yml
...
#7 20.14   Install: 117 packages
#7 20.14 
#7 20.14   Total download: 192MB
─────────────────────────────────────────────────────────────────────────────────────────
#7 20.14 Transaction starting

In info log, one can see a bit more (new run hence different timings):

#7 21.54 info     libmamba Transfer done for 'coin-or-clp'
#7 21.54 info     libmamba Transfer finalized, status: 200 [https://conda.anaconda.org/conda-forge/linux-64/coin-or-clp-1.17.8-h1ee7a9c_0.conda] 1173622 bytes
#7 21.54 info     libmamba Download finished, validating '/opt/conda/pkgs/coin-or-clp-1.17.8-h1ee7a9c_0.conda'

This is what happens in debug (again different run hence ignore relative timing):

#7 28.93 debug    libmamba Running in-process extraction for '/opt/conda/pkgs/git-lfs-3.4.0-ha770c72_0.conda'
#7 29.03 debug    libmamba Extracted to '/opt/conda/pkgs/mpi-1.0-openmpi'
#7 29.03 debug    libmamba Decompressing '/opt/conda/pkgs/connection_pool-0.0.3-pyhd3deb0d_0.tar.bz2'
#7 29.03 debug    libmamba Running subprocess extraction '/bin/micromamba package extract /opt/conda/pkgs/connection_pool-0.0.3-pyhd3deb0d_0.tar.bz2 /opt/conda/pkgs/connection_pool-0.0.3-pyhd3deb0d_0'

There is absolutely no progress hereafter, even after 10 minutes. How can I fix this?

答案1

得分: 2

这似乎是由已知的QEMU问题与mamba使用子进程的结合导致的。关于QEMU和mamba的交互在这个mamba问题中有详细讨论。对我有效的解决方案是在任何mamba installmamba create之前运行以下命令:

micromamba config set extract_threads 1

即修改Dockerfile如下:

FROM mambaorg/micromamba:1.4.9
COPY environment.yml /environment.yml
RUN micromamba config set extract_threads 1 # <---- 这是修复的添加行
RUN micromamba create -vv -y -n pangolin -f /environment.yml

这个错误可能是随机的,因为它取决于多个进程的使用。如果你“幸运”的话,大部分时间可能可以避免这个错误。

英文:

This appears to be due to a known QEMU issue combined with mamba's use of subprocesses. The interaction of QEMU and mamba was discussed extensively in this mamba issue. The solution that worked for me was to run the following before any mamba install or mamba create:

micromamba config set extract_threads 1

i.e. modifying the Dockerfile as follows:

FROM mambaorg/micromamba:1.4.9
COPY environment.yml /environment.yml
RUN micromamba config set extract_threads 1 # <---- This is the added line that fixes it
RUN micromamba create -vv -y -n pangolin -f /environment.yml

The bug may be stochastic as it depends on multiple processes being used. If you're "lucky" you might avoid the bug most of the time.

huangapple
  • 本文由 发表于 2023年7月27日 17:32:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76778360.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定