应该将 conda 还是 conda-forge 用于 Python 环境?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39857289/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Should conda, or conda-forge be used for Python environments?
提问by tilikoom
Conda
and conda-forge
are both Python package managers. What is the appropriate choice when a package exists in both repositories? Django, for example, can be installed with either, but the difference between the two is several dependencies (conda-forge has many more). There is no explanation for these differences, not even a simple README.
Conda
并且conda-forge
都是 Python 包管理器。当两个存储库中都存在一个包时,合适的选择是什么?例如,Django 可以安装任何一个,但两者之间的区别在于几个依赖项(conda-forge 有更多)。没有解释这些差异,甚至没有一个简单的自述文件。
Which one should be used? Conda or conda-forge? Does it matter?
应该使用哪一种?Conda 还是 conda-forge?有关系吗?
回答by darthbith
The short answer is that, in my experience generally, it doesn't matter which you use.
简短的回答是,根据我的经验,一般来说,使用哪个并不重要。
The long answer:
长答案:
So conda-forge
is an additional channel from which packages may be installed. In this sense, it is not any more special than the default channel, or any of the other hundreds (thousands?) of channels that people have posted packages to. You can add your own channel if you sign up at https://anaconda.organd upload your own Conda packages.
conda-forge
可以安装软件包的附加通道也是如此。从这个意义上说,它并不比默认频道或人们发布包裹的其他数百(数千?)个频道中的任何一个更特别。如果您在https://anaconda.org上注册并上传您自己的 Conda 包,则可以添加您自己的频道。
Here we need to make the distinction, which I think you're not clear about from your phrasing in the question, between conda
, the cross-platform package manager, and conda-forge
, the package channel. Anaconda Inc. (formerly Continuum IO), the main developers of the conda
software, also maintain a separate channel of packages, which is the default when you type conda install packagename
without changing any options.
在这里,我们需要区分,我认为您在问题中的措辞中并不清楚conda
跨平台包管理器和conda-forge
包通道之间的区别。该conda
软件的主要开发商 Anaconda Inc.(前身为 Continuum IO)也维护着一个单独的软件包通道,这是您在conda install packagename
不更改任何选项的情况下键入时的默认设置。
There are two ways to change the options for channels. One is to specify a channel every time you install a package:
有两种方法可以更改频道选项。一种是在每次安装包时指定一个频道:
conda install -c some-channel packagename
Of course, the package has to exist on that channel. If you find yourself using the same channel often, then you might want to add it to your configuration. You can write
当然,该软件包必须存在于该频道上。如果您发现自己经常使用同一个频道,那么您可能希望将其添加到您的配置中。你可以写
conda config --add channels some-channel
to add the channel some-channel
to the top of the channels
configuration list. This gives some-channel
the highest priority (priority determines (in part) which channel is selected when more than one channel has a particular package). To add the channel to the end of the list and give it the lowest priority, type
将频道添加some-channel
到channels
配置列表的顶部。这给出some-channel
了最高优先级(优先级决定(部分)当多个频道具有特定包时选择哪个频道)。要将频道添加到列表末尾并为其赋予最低优先级,请键入
conda config --append channels some-channel
If you would like to remove the channel that you added, you can do so by writing
如果你想删除你添加的频道,你可以写
conda config --remove channels some-channel
See
看
conda config -h
for more options.
更多选择。
With all of that said, there are four main reasons to use the conda-forge
channel instead of the defaults
channel maintained by Anaconda:
综上所述,使用conda-forge
通道而不是defaults
Anaconda 维护的通道有四个主要原因:
- Packages on
conda-forge
maybe more up-to-date than those on thedefaults
channel - There are packages on the
conda-forge
channel that aren't available fromdefaults
- You would prefer to use a dependency such as
openblas
(fromconda-forge
) instead ofmkl
(fromdefaults
). - If you are installing a package that requires a compiled library (e.g., a C extension or a wrapper around a C library), it mayreduce the chance of incompatibilities if you install all of the packages in an environment from a single channel due to binary compatibility of the base C library (but this advice may be out of date/change in the future).
- 上的包
conda-forge
可能比defaults
频道上的包更新 conda-forge
频道上有无法从以下渠道获得的套餐defaults
- 您更愿意使用诸如
openblas
(fromconda-forge
) 之类的依赖项而不是mkl
(fromdefaults
)。 - 如果要安装一个需要编译库包(如C扩展或围绕一个C库的包装),它可以减少不兼容的,如果你从一个单一的通道安装所有软件包的环境中,由于二进制的机会基础 C 库的兼容性(但此建议可能会过时/将来更改)。
回答by adrin
Anaconda has changed their Terms of Serviceso that "heavy commercial users" would have to pay, which doesn't include conda-forge
channel.
Anaconda 更改了他们的服务条款,以便“重度商业用户”必须付费,其中不包括conda-forge
频道。
You probably would want to stick to conda-forge
if you don't want to pay for the usage. As stated in the docs:
conda-forge
如果您不想为使用付费,您可能希望坚持使用。如文档中所述:
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install <package-name>
You could also use miniforgewhich has conda-forge
as the default channel, and supports ppc64le and aarch64 platforms as well as the other usual ones.
你也可以使用miniforge具有conda-forge
作为默认的通道,并支持ppc64le和aarch64平台,以及其他常用的。
回答by ewalel
There are some Python libraries that you cannot install with a simple conda install
since their channel is not available unless you apply conda-forge. From my experience, pip is more generic to look into different channel sources than conda.
For instance, if you want to install python-constraint
you can do it via pip install
but to install it via **cond **. you have to specify the channel - conda-forge
.
有一些 Python 库您无法使用 simple 安装,conda install
因为除非您应用 conda-forge,否则它们的频道不可用。根据我的经验,pip 比 conda 更通用,可以查看不同的渠道来源。例如,如果您想安装,python-constraint
您可以pip install
通过 **cond ** 进行安装。您必须指定频道 - conda-forge
。
conda install -c conda-forge python-constraint // works
but not
但不是
conda install python-constraint
回答by Ashiq Imran
The conda-forge channel is where you can find packages that have been built for conda but yet to be part of the official Anaconda distribution.
在 conda-forge 频道中,您可以找到为 conda 构建但尚未成为官方 Anaconda 发行版的一部分的软件包。
Generally, you can use any of them.
通常,您可以使用其中任何一个。