anaconda更新所有可能的软件包吗? [英] anaconda update all possible packages?

查看:203
本文介绍了anaconda更新所有可能的软件包吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了conda search --outdated,其中有很多过时的软件包,例如scipy是0.17.1,但最新的是0.18.0.但是,当我执行conda update --all时.它不会更新任何软件包.

I tried the conda search --outdated, there are lots of outdated packages, for example the scipy is 0.17.1 but the latest is 0.18.0. However, when I do the conda update --all. It will not update any packages.

更新1

conda update --all --alt-hint

Fetching package metadata .......
Solving package specifications: ..........

# All requested packages already installed.
# packages in environment at /home/user/opt/anaconda2:
#

更新2

我可以分别更新那些软件包.我可以做conda update scipy.但是为什么我不能一口气更新它们呢?

I can update those packages separately. I can do conda update scipy. But why I cannot update all of them in one go?

推荐答案

TL; DR:依赖冲突:更新一项要求 (根据其要求)降级另一个

TL;DR: dependency conflicts: Updating one requires (by it's requirements) to downgrade another

您是对的

conda update --all

实际上是 1 的方法. Conda始终尝试将软件包升级到系列中的最新版本(例如Python 2.x或3.x).

is actually the way to go1. Conda always tries to upgrade the packages to the newest version in the series (say Python 2.x or 3.x).

但是可能存在依赖关系冲突(这会阻止进一步升级).康达通常会非常明确地发出警告.

But it is possible that there are dependency conflicts (which prevent a further upgrade). Conda usually warns very explicitly if they occur.

例如X要求Y< 5.0,因此Y永远不会> = 5.0

e.g. X requires Y <5.0, so Y will never be >= 5.0

这就是为什么您无法全部"升级它们的原因.

That's why you 'cannot' upgrade them all.

要补充:也许它可以工作,但是conda中没有使用Y> 5.0的X的较新版本.可以使用pip进行安装,因为pip中提供了更多软件包.但是请注意,如果存在依赖关系冲突,pip也会安装软件包,并且通常会破坏conda环境,因为您无法再可靠地使用conda进行安装.如果这样做,请在所有软件包都已安装conda之后再作最后的选择.相当可笑.

一种安全的方法是在升级时添加 conda-forge 作为渠道(添加作为标志)或其他任何包含软件包的频道,如果您确实需要此新版本.这样,conda也会在此位置搜索可用的软件包.

A safe way you can try is to add conda-forge as a channel when upgrading (add -c conda-forge as a flag) or any other channel you find that contains your package if you really need this new version. This way conda does also search in this places for available packages.

考虑您的更新:您可以分别对其进行升级,但是这样做不仅包括升级,还包括对其他软件包的降级.说,添加到上面的示例中:

Considering your update: You can upgrade them each separately, but doing so will not only include an upgrade but also a downgrade of another package as well. Say, to add to the example above:

X> 2.0要求Y< 5.0,X < 2.0要求Y> 5.0

X > 2.0 requires Y < 5.0, X < 2.0 requires Y > 5.0

因此,升级Y> 5.0意味着将X降级为< 2.0,反之亦然.

So upgrading Y > 5.0 implies downgrading X to < 2.0 and vice versa.

(这当然是一个教学示例,但实际上是相同的,通常只是具有更复杂的依赖项和子依赖项)

因此,您仍然无法通过单独进行升级来全部升级它们.依赖关系是无法令人满意的,因此早晚要进行升级,升级将再次降级已经升级的软件包.或破坏软件包的兼容性(您通常不希望这样做!),这只能通过显式调用 ignore-dependencies force -命令来实现.但这只是 hack 解决问题的方式,绝对不是普通用户的情况!

So you still cannot upgrade them all by doing the upgrades separately; the dependencies are just not satisfiable so earlier or later, an upgrade will downgrade an already upgraded package again. Or break the compatibility of the packages (which you usually don't want!), which is only possible by explicitly invoking an ignore-dependencies and force-command. But that is only to hack your way around issues, definitely not the normal-user case!

1 如果您实际上要更新安装软件包,而通常不要.在基本环境中运行的命令将以此更新软件包,但是通常您应该使用虚拟环境(conda create -n myenv,然后是conda activate myenv).在这样的环境中执行conda update --all将会在该环境中 中更新软件包.但是,由于基本环境也是环境,因此答案以相同的方式适用于两种情况.

1 If you actually want to update the packages of your installation, which you usually don't. The command run in the base environment will update the packages in this, but usually you should work with virtual environments (conda create -n myenv and then conda activate myenv). Executing conda update --all inside such an environment will update the packages inside this environment. However, since the base environment is also an environment, the answer applies to both cases in the same way.

这篇关于anaconda更新所有可能的软件包吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆