关于 Arm 处理器上的 conda 发行版/通道的混乱

发布于 2025-01-13 19:06:45 字数 959 浏览 0 评论 0原文

我已经使用 Anaconda 几年了,但自从我开始使用带有 M1 处理器的 Mac 以来,我不得不处理一些软件包安装的一系列问题,这让我对一些基本概念有点困惑。

例如,我试图安装 Tensorflow,结果发现正确的方法是安装 miniforge,并从 conda-forge 通道(这是 miniforge 的默认通道)获取 Tensorflow,如所解释的 此处。 然后,我想知道是否可以使用 Anaconda/Miniconda 执行相同操作...将 conda-forge 通道设置为默认通道,并安装 Tensorflow(或任何其他与 arm 兼容的软件包),但是 我被告知不是可能

所以,现在我试图了解这一切是如何运作的。 如果 conda-forge 通道中存在与 M1 处理器兼容的 Tensorflow 版本(并且确实存在),为什么在将其配置为使用该通道后无法使用 Anaconda/Miniconda 安装它?换句话说,Anaconda/Miniconda 和 Miniforge 之间有什么区别,除了它们寻找软件包的渠道(以及据我所知,还有一些许可证)?

这里有一个类似的问题,但答案没有这似乎解决了我主要关心的问题(为什么以 conda-forge 作为默认通道的 Anaconda/Miniconda 与 miniforge 不同)。

I've been using Anaconda for a few years now, but since I started using a Mac with a M1 processor I had to deal with a bunch of problem with the installation of some packages, which left me a little confused about some basic concepts.

For example, I was trying to install Tensorflow, and it turns out the proper way is to install miniforge, and get Tensorflow from the conda-forge channel (which is the default for miniforge), as explained here.
Then, I was wondering whether I could do the same using Anaconda/Miniconda...set up the conda-forge channel as default, and install Tensorflow (or any other arm-compatible package), but I've been told it's not possible

So, now I'm trying to understand how this all works.
If a Tensorflow version compatible with M1 processors exists in the conda-forge channel (and it does exist), why can't I install it by using Anaconda/Miniconda, after configuring it to use said channel? To phrase it in another way, what is the difference between Anaconda/Miniconda and Miniforge, other than the channels they look into for packages (and, as I understand, some licenses)?

Here there is a similar question, but the answers don't seem to address my main concern (why Anaconda/Miniconda with conda-forge as default channel is different than miniforge).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

稚气少女 2025-01-20 19:06:45

这并非不可能,但你必须克服重重困难才能完成它。
首先,如果您安装了 Anaconda,则无法一致地将 conda-forge 包安装到基础环境中,因为 Anaconda 基础环境中的 anaconda 包会与 conda-forge 中的包发生冲突。
其次,由于 Anaconda 目前只有 x86_64,因此您只能通过 Rossetta 仿真来安装它。之后,您需要通过设置环境变量 CONDA_SUBDIR 告诉 conda 您需要 arm64 兼容的软件包。

CONDA_SUBDIR=osx-arm64 conda create -n native numpy -c conda-forge

将为您提供一个带有本机 arm64 软件包的新环境。但是,如果您想更新此环境,则必须在所有 conda 命令前添加 CONDA_SUBDIR=osx-arm64 前缀。

要永久修复此问题,您可以执行以下操作

conda activate native
conda config --env --set subdir osx-arm64

,使 conda 在此环境中使用 osx-arm64。

It's not impossible, but you'll have to jump through hoops to get it done.
First, if you have an Anaconda installation, you can't install conda-forge packages into the base environment consistently, because the anaconda package in the base environment of Anaconda will conflict with packages from conda-forge.
Second, since Anaconda is only x86_64 at the moment, you can only install it via Rossetta emulation. After that, you need to tell conda that you need arm64 compatible packages by setting the env variable CONDA_SUBDIR.

CONDA_SUBDIR=osx-arm64 conda create -n native numpy -c conda-forge

will get you a new env with native arm64 packages. However if you want to update this env, you have to prefix all your conda commands with CONDA_SUBDIR=osx-arm64.

To fix this permanently, you can do the following

conda activate native
conda config --env --set subdir osx-arm64

which will make conda use osx-arm64 for this environment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文