Aug*_*ley 6 python docker tensorflow apple-m1
我正在尝试使用新的 Mac M1 运行一些项目。这些项目已经在英特尔处理器上运行,并被使用英特尔的其他开发人员使用。
我无法构建这个简单的 Dockerfile:
FROM python:3.9
RUN python -m pip install --upgrade pip
RUN pip install tensorflow==2.6.2
Run Code Online (Sandbox Code Playgroud)
我收到这条消息:
> [3/3] RUN pip install tensorflow==2.6.2:
#6 0.583 ERROR: Could not find a version that satisfies the requirement tensorflow==2.6.2 (from versions: none)
#6 0.583 ERROR: No matching distribution found for tensorflow==2.6.2
Run Code Online (Sandbox Code Playgroud)
我可以在 Dockerfile 之外本地安装 Tensorflow。此外,朋友们还可以从他们的英特尔 Mac 上构建此映像。
我什至尝试运行 docker build com 不同的控制台架构:i386 和 arm64,但都不起作用。
有什么建议么?
编辑:您可能想通过查看https://github.com/KumaTea/tensorflow-aarch64来检查menrfa 的答案
包tensorflow不适用于armv8。
我猜你的本地Python正在使用rosetta2(intel x86_64)运行。您可以使用以下方法检查:
python3 -c "import platform; print(platform.machine())"
x86_64
Run Code Online (Sandbox Code Playgroud)
解决方案是强制 Docker 也构建该镜像x86_64。这很容易。只需将 Dockerfile 更改为:
FROM --platform=linux/x86_64 python:3.9
RUN python -m pip install --upgrade pip
RUN pip install tensorflow==2.6.2
Run Code Online (Sandbox Code Playgroud)
或者,如果您不想更改 Dockerfile,您可以使用以下命令构建该映像:
docker build --platform linux/x86_64 -t myimage .
Run Code Online (Sandbox Code Playgroud)
帖子备注:
正如[tyrex]在评论中所说,虽然tensorflow安装在armv8上,但由于仿真上的一些错误(例如qemu: uncaught target signal 6 (Aborted) - core dumped),它可能会失败。
他使用 PyTorch 解决了他的需求。
以下内容对我有用。(芯片Apple M1 Pro + MacOS 12.1)
Docker:Debian GNU/Linux 11(靶心)
RUN pip install tensorflow==2.6.0 -f https://tf.kmtea.eu/whl/stable.html
Run Code Online (Sandbox Code Playgroud)
显然要感谢https://github.com/KumaTea/tensorflow-aarch64
| 归档时间: |
|
| 查看次数: |
3789 次 |
| 最近记录: |