windows 上的 Conda 自定义频道

Conda custom channel on windows

我按照 here 的详细步骤在 windows 盒子上创建了自定义频道。

现在我想从另一台机器访问它,但通道参数是一个 URI,我不知道它应该采用什么形式 Windows。

这是我尝试执行的命令:

conda search -c file://machine\C\channel --override-channels scipy

失败并显示以下错误消息:

Fetching package metadata: Error: Invalid index file

假设您的自定义频道位于以下目录中: N:\conda\channel。然后我们希望在这个目录中看到以下内容 (1) win-64 目录 (2) 里面的索引文件,在本例中是 N:\conda\channel\win-64\ 目录, repodata.json 和 [=14] =] (3) 您添加到频道中的任何包。在这个频道上搜索 scipy 包,忽略所有其他频道,看起来像这样 conda search -c file://N:\conda\channel --override-channels scipy

您是否将 scipy 包添加到您的自定义频道?如果你这样做了,那么你在那个目录上 运行 conda index 了吗?

我对你的目录结构有点困惑,但是,如果你的频道是 machine\C\channel,那么当你 dir machine\C\channel 时会发生什么?

我一直在尝试做同样的事情,让我有点悲观。

事实证明可以使用 UNC 路径。 在尝试了数百种斜杠和反斜杠的组合后,我发现这种组合有效:

conda search -c "file://\DOMAIN\SERVER\SHARE\conda\channel" --override-channels

同样,

conda config --add channels "file://\DOMAIN\SERVER\SHARE\conda\channel"

将频道添加到您的配置文件。

如果您尝试在本地目录(而不是 UNC)中搜索 conda 包,以下两种方法对我有用。

  1. 导航到包含软件包的驱动器并尝试

conda search -c file://folder_path/channel --override-channels

  1. 更好的方法是删除 file 标志,这样您就可以从任何驱动器进行搜索。类型

conda search -c Drive://folder_path/channel --override-channels 因此,如果您从 D: 驱动器搜索,您可以将其键入 conda search -c D://folder_path/channel --override-channels

虽然 帮助我找到了正确的方向,但其他答案我没有成功。也许 API 已经改变了。测试几个不同的选项我有点惊讶

  • 你可以交替使用/\
  • 你不需要转义空格
  • 您不需要用引号将带空格的路径括起来

创建 custom channel in a network accessible directory, you can search for a conda package using the file path, excluding the file:// mentioned in other posts and in the documentation 之后。

对于 UNC 路径:

$ conda search -c //my_nas/some/path with spaces/channel --override-channels

或 $ conda search -c \my_nas\some\path with spaces\channel --override-channels

如果文件夹是本地的,或者您已将网络目录挂载到本地路径(本例中为D:\),您将使用该文件路径。

$ conda search -c D:/some/path with spaces/channel --override-channels 

$ conda search -c D:\some\path with spaces\channel --override-channels 

我使用 Git Bash for Windows 和 Anaconda Prompt 测试了这些命令(我认为只是 cmd.exe 修改了路径,所以 base/root 是活动环境).

请注意,如果您想将该路径添加到您的 .condarc 文件中,您可以使用相同的路径。

channels: - \my_nas\some\path with spaces\channel # UNC - D:/some/path with spaces/channel # local drive - defaults # this gives defaults lower priority ssl_verify: true

如果您的 conda 频道位于 C:\conda-channel 则执行:

conda search -c file://\conda-channel --override-channels

目前 conda 4.6+ 中存在一个错误,其中 file://C:\conda-channel 将不起作用,因为它在解析时删除了冒号。降级到 4.5 很危险,可能会搞乱您的安装。