如何删除Conda中的频道?

时间:2019-10-14 00:32:17

标签: python anaconda conda

如何删除一个频道,或者至少指示Conda在其中一个频道网址关闭的情况下不中止?

我正在测试一个有问题的工具,该工具在select t1.department, t1.first_name, t1.salary , case when coalesce(minSalary.salary, 0) > 0 then 'lowest salary' when coalesce(maxSalary.salary, 0) > 0 then 'highest salary' else 'N/A' end as salary_by_department from employees t1 left join (select department, first_name, min(salary) as salary from employees group by department, first_name) minSalary on minSalary.first_name = t1.first_name and t1.department = minSalary.department left join (select department, first_name, max(salary) as salary from employees group by department, first_name) maxSalary on maxSalary.first_name = t1.first_name and t1.department = maxSalary.department group by t1.department, t1.first_name, t1.salary 提供了一个Conda存储库,但是现在该存储库已脱机,并且现在所有对@api_view(['GET', 'POST']) def page_list(request): # your code here 的调用都失败,并显示以下消息:

https://www.idiap.ch/software/bob/conda/linux-64

我在create命令中没有使用此通道,所以我不知道为什么Conda失败而不是忽略它。如何允许Conda继续或清除频道?

我尝试通过运行以下方式删除频道:

conda create --prefix=./cenv -y python=3.7

输出错误:

Collecting package metadata (current_repodata.json): failed

CondaHTTPError: HTTP 503 SERVICE UNAVAILABLE for url <https://www.idiap.ch/software/bob/conda/linux-64/current_repodata.json>
Elapsed: 00:02.470723

A remote server error occurred when trying to retrieve this URL.

A 500-type error (e.g. 500, 501, 502, 503, etc.) indicates the server failed to
fulfill a valid request.  The problem may be spurious, and will resolve itself if you
try your request again.  If the problem persists, consider notifying the maintainer
of the remote server.

编辑:我的conda config --remove channels https://www.idiap.ch/software/bob/conda 是:

CondaKeyError: 'channels': 'https://www.idiap.ch/software/bob/conda' is not in the 'channels' key of the config file

正在运行:

conda info

输出错误:

     active environment : None
            shell level : 0
       user config file : /home/myuser/.condarc
 populated config files : /home/myuser/miniconda3/.condarc
                          /home/myuser/.condarc
          conda version : 4.7.12
    conda-build version : not installed
         python version : 3.7.3.final.0
       virtual packages : 
       base environment : /home/myuser/miniconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://www.idiap.ch/software/bob/conda/linux-64
                          https://www.idiap.ch/software/bob/conda/noarch
          package cache : /home/myuser/miniconda3/pkgs
                          /home/myuser/.conda/pkgs
       envs directories : /home/myuser/miniconda3/envs
                          /home/myuser/.conda/envs
               platform : linux-64
             user-agent : conda/4.7.12 requests/2.22.0 CPython/3.7.3 Linux/4.15.0-64-generic ubuntu/18.04.3 glibc/2.27
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False

这些是我的conda config --remove channels https://www.idiap.ch/software/bob/conda/linux-64 conda config --remove channels https://www.idiap.ch/software/bob/conda/noarch 的内容:

CondaKeyError: 'channels': 'https://www.idiap.ch/software/bob/conda/<name>' is not in the 'channels' key of the config file

2 个答案:

答案 0 :(得分:1)

conda config --remove channels https://www.idiap.ch/software/bob/conda

在我的测试中工作。

另一种方法是打开.condarc目录下的$HOME个文件,并注释掉相应的频道行。

答案 1 :(得分:0)

据我所知,conda区分频道名称和频道URL。即conda info将输出如下内容:

           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch

conda config --show channels将输出

channels:
  - defaults

我认为您必须删除频道名称而不是其网址。

在您的主目录中,还应该有一个名为.condarc的文件,其中包含所有用户的自定义设置,包括通道。您可以使用文本编辑器打开该文件,然后从此处删除频道。

最后还有一个标记--override-channels,它会忽略默认频道以及在.condarc中设置的所有频道,这意味着您必须手动指定要在自己的频道中使用的频道conda命令。