重置conda通道优先级

时间:2018-01-31 16:35:02

标签: anaconda conda channel

我遇到了康达的问题。运行命令后如:

jQuery(".GenderM1").each(function() {
  var isChecked = jQuery(this).prop('checked');
  if (isChecked == false) {
    e.preventDefault();
    pass = "false";
    alert("Please select gender.");
    return false;
  }
});

默认的conda频道现已成为' my_conda_channel'这样来自该频道的每个后续包都会取代默认频道,这不是我想要的。我只是出于测试目的而做了前者。

如何重置频道行为?

6 个答案:

答案 0 :(得分:12)

~/.condarc更改订单,以便将defaults第一个频道改为

channels:
  - defaults
  - conda-forge

并将此行添加到其中

channel_priority: true

或在命令行中运行以下代码

conda config --set channel_priority true

然后再次运行

conda update --all

祝你好运

答案 1 :(得分:4)

转到您的主目录并在编辑器中打开.condarc。转到channels并修改优先级:

channels:
  - defaults
  - my_conda_channel

现在defaults优先于my_conda_channel。您也可以删除my_conda_channel

答案 2 :(得分:2)

另一种选择是将您的频道移至优先级列表的底部。
运行命令...。

conda config --append channels my_conda_channel

您应该收到这样的回复...

Warning: 'my_conda_channel' already in 'channels' list, moving to the bottom

验证...

conda config --get channels

哪个应该给你类似...

--add channels 'defaults'   # highest priority
--add channels 'my_conda_channel'   # lowest priority

答案 3 :(得分:0)

在环境的conda-meta目录中,我添加了一个名为“固定”的文件:

固定:

tensorflow               ==2.2.0
tensorflow-base          ==2.2.0
tensorflow-datasets      ==1.2.0
tensorflow-estimator     ==2.2.0

然后,conda更新-都没有更新软件包:

$ conda update --all
Collecting package metadata (current_repodata.json): - NVIDIA: no NVIDIA devices found
done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.8.4
  latest version: 4.9.1

Please update conda by running

    $ conda update -n base -c defaults conda



## Package Plan ##

  environment location: /home/ubuntu/anaconda2/envs/ai


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    awscli-1.18.169            |   py36h5fab9bb_0         1.8 MB  conda-forge
    boto3-1.16.9               |     pyhd8ed1ab_0          70 KB  conda-forge
    botocore-1.19.9            |     pyhd3deb0d_0         4.1 MB  conda-forge
    giflib-5.2.1               |       h36c2ea0_2          77 KB  conda-forge
    hypothesis-5.41.0          |     pyhd8ed1ab_0         222 KB  conda-forge
    jpeg-9d                    |       h36c2ea0_0         264 KB  conda-forge
    libpng-1.6.37              |       h21135ba_2         306 KB  conda-forge
    pandas-1.1.4               |   py36hd87012b_0        10.5 MB  conda-forge
    tornado-6.1                |   py36h1d69622_0         644 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        17.9 MB

The following packages will be REMOVED:

  keras-applications-1.0.8-py_1

The following packages will be UPDATED:

  awscli                            1.18.168-py36h5fab9bb_0 --> 1.18.169-py36h5fab9bb_0
  boto3                                 1.16.8-pyhd8ed1ab_0 --> 1.16.9-pyhd8ed1ab_0
  botocore                              1.19.8-pyhd3deb0d_0 --> 1.19.9-pyhd3deb0d_0
  hypothesis                            5.40.0-pyhd8ed1ab_0 --> 5.41.0-pyhd8ed1ab_0
  pandas                               1.1.3-py36h66e3816_2 --> 1.1.4-py36hd87012b_0
  tornado                              6.0.4-py36h8c4c3a4_2 --> 6.1-py36h1d69622_0

The following packages will be DOWNGRADED:

  giflib                                   5.2.1-h516909a_2 --> 5.2.1-h36c2ea0_2
  jpeg                                        9d-h516909a_0 --> 9d-h36c2ea0_0
  libpng                                  1.6.37-hed695b0_2 --> 1.6.37-h21135ba_2


Proceed ([y]/n)? y


Downloading and Extracting Packages
hypothesis-5.41.0    | 222 KB    | ######################################### | 100% 
tornado-6.1          | 644 KB    | ######################################### | 100% 
boto3-1.16.9         | 70 KB     | ######################################### | 100% 
libpng-1.6.37        | 306 KB    | ######################################### | 100% 
awscli-1.18.169      | 1.8 MB    | ######################################### | 100% 
jpeg-9d              | 264 KB    | ######################################### | 100% 
botocore-1.19.9      | 4.1 MB    | ######################################### | 100% 
pandas-1.1.4         | 10.5 MB   | ######################################### | 100% 
giflib-5.2.1         | 77 KB     | ######################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

$ conda list tensorflow
# packages in environment at /home/ubuntu/anaconda2/envs/ai:
#
# Name                    Version                   Build  Channel
tensorflow                2.2.0           mkl_py36h5a57954_0  
tensorflow-base           2.2.0           mkl_py36hd506778_0  
tensorflow-datasets       1.2.0                    py36_0    anaconda
tensorflow-estimator      2.2.0              pyh95af2a2_0    conda-forge
tensorflow-metadata       0.14.0             pyhe6710b0_1  


答案 4 :(得分:0)

遗憾的是,截至 2021 年 4 月,所有解决方案均不适合我。

有几个 .condarc 文件需要编辑,以确保所需的频道优先级:

  1. ~/.condac。在这里,您会找到“全局”频道,这些频道预先添加到手动添加的所有其他频道(例如,default 频道,或者 conda-forge 以某种方式到达这里,在我的情况下,即使我没有手动添加它) .通过命令行界面更改/添加其他频道不会取代此处列出的频道的最高优先级

  2. .condarc 文件位于 anaconda 根目录中。这是手动添加的频道结束的地方(我还会检查 ~/anaconda3/envs/{env_names}/ 以获取特定于环境的 .condarc 文件)。

如果您想完全控制频道优先级:

  1. 清理 ~/.condarc 文件中的频道部分(顶部)。
  2. 根据所需的通道优先级手动编辑 .condarc 个文件,每个环境(包括基础)一个文件
  3. 将频道优先级设置为 truestrict
  4. 使用 conda config --show channels
  5. 检查您的编辑结果

答案 5 :(得分:0)

您可以按如下方式更改频道优先级:

  1. conda 配置 --get 这将列出从最低优先级到最高优先级的所有频道
  2. 使用添加频道 conda config --add 频道 ---(你的频道) 您添加的最后一个频道获得最高优先级……所以请保持顺序。您可以添加频道,即使您已经拥有它们,以便更改优先级顺序