从文件创建提供CondaHTTPError:HTTP 404 NOT FOUND(Create from file gives CondaHTTPError: HTTP 404 NOT FOUND)

编程入门 行业动态 更新时间:2024-10-22 23:33:45
文件创建提供CondaHTTPError:HTTP 404 NOT FOUND(Create from file gives CondaHTTPError: HTTP 404 NOT FOUND)

我创建了一个Anaconda Python Conda环境并导出了一个spec文件,因此我可以在以后使用命令conda list --explicit重新安装完全相同的环境。 那天是今天,但我很失望地看到其中一个文件不可用并被更新的版本所取代:

https://conda.anaconda.org/conda-forge/win-64/gdal-2.1.3-np111py35_vc14_0.tar.bz2 https://conda.anaconda.org/conda-forge/win-64/gdal-2.1 0.3-np111py35_vc14_7.tar.bz2

Conda遇到错误,因为链接已断开,然后多次重试失败:

CondaError: CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/conda-forge/win-64/gdal-2.1.3-np111py35_vc14_0.tar.bz2 Elapsed: 00:01.270000 CF-RAY: 3fa8f7eb093298a1-LAX An HTTP error occurred when trying to retrieve this URL. HTTPerrors are often intermittent, and a simple retry will get you on your way.

四部分问题:

spec文件是否仅用于短期使用? 我应该独立存档每个.bz2文件,以便以后能够重新创建环境吗? 是否有可用的工具来帮助我这样做,或者我应该查看文件夹并手动查找我需要的内容并将其复制并使用conda安装每个文件夹? 有没有更好的方法来检查spec文件的所有链接的有效性,而不是尝试安装它并观察它崩溃? 看起来conda将检查它是否已经在另一个环境中下载了相同的文件,并且不会尝试另一次下载,并且可以隐藏损坏的链接。

I created an Anaconda Python Conda environment and exported a spec file so I could re-install the exact same environment at a later date if necessary using the command conda list --explicit. That day is today, but I'm disappointed to see that one of the files isn't available and was replaced with a newer version:

https://conda.anaconda.org/conda-forge/win-64/gdal-2.1.3-np111py35_vc14_0.tar.bz2 https://conda.anaconda.org/conda-forge/win-64/gdal-2.1.3-np111py35_vc14_7.tar.bz2

Conda encounters an error because the link is broken and then it retries unsuccessfully several times:

CondaError: CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/conda-forge/win-64/gdal-2.1.3-np111py35_vc14_0.tar.bz2 Elapsed: 00:01.270000 CF-RAY: 3fa8f7eb093298a1-LAX An HTTP error occurred when trying to retrieve this URL. HTTPerrors are often intermittent, and a simple retry will get you on your way.

Four-part question:

Are spec files intended only for very short term usage? Should I be archiving each .bz2 file independently to be able to recreate the environment later? Is there a tool available to help me do this, or should I look through the folders and manually find what I need and copy it and conda install each one? Is there a better way to check the validity of all the links of a spec file other than attempting to install it and watching it crash? It looks like conda will check to see if it has already downloaded the same file in another environment and won't attempt another download and the broken link could be hidden.

最满意答案

在conda频道中,无法保证您使用的工具版本将永久保留。 例如,如果在工具中发现错误,则会更正错误,并且将使用较新的版本代替旧版本。

conda list --explicit不是一种非常好的导出环境的方法,因为你说它只会在很短的时间内起作用。 而且,它不能移植到其他操作系统。 我会推荐conda env export或conda list --export如conda doc中所述: https ://conda.io/docs/commands/env/conda-env-export.html。这样,工具的版本将会保留但不是完整的URL,其中每个包可以下载,哪些可能经常更改。

所以回答

Q1: 如果以正确的方式导出环境,则可以随时使用它们。 您永远无法确定10年前使用的工具版本是否仍然可用,但conda会在导入您的环境时告诉您。

Q2: 您可以创建自己的conda频道,并使用固定版本打包所需的任何工具。 但问题是:“你真的需要这个吗?” 这意味着您无法升级所使用的工具。 有时,最好更新代码并使用较新版本的工具,而不是保留旧的错误版本或忘记改进。

我从来没有测试过,但在另一篇文章中,我读到环境是自包含在一个文件夹, $CONDA_HOME/envs/[your_env] ,如果它是相同的架构(linux64,windows,OSX),这个文件夹可以直接复制到另一个conda安装中...)。

Q3: 除了conda env export之外,没有这方面的工具。 顺便说一句,我认为所有下载的软件包都在$CONDA_HOME/pkgs 。

Q4: 不,因为它不是导出环境的好方法。 有关信息,conda不会为不同的环境多次下载相同的软件包。 它重用已经安装的软件包。 您可以在家中添加名为.condarc的文件,并将该文件allow_softlinks: false 。 这将告诉conda重新安装新环境安装所需的任何软件包,而不是链接已安装在其他环境中的工具。

In conda channels, there is no guarantee that the versions of the tools you use will be maintained forever. For example, if a bug is found in a tool, it will be corrected and a newer version will be put in place of the old version.

conda list --explicit is not a very good way to export environments as, you said it, it will only work for a very short term. Moreover, it is not portable to other OS. I would recommend conda env export or conda list --export as stated in the conda doc: https://conda.io/docs/commands/env/conda-env-export.html .This way, the versions of the tools will be kept but not the full URL where each package can be downloaded and which are likely to change often.

So to answer

Q1: If you export environments the right way, you can use them over time. You can never be sure that the version of a tool you used 10 years ago will still be available, but conda will tell you this when importing your environment.

Q2: You can create you own conda channel and package whatever tool you want with fixed versions. But the question is: "do you really need this?". It means you get no upgrade for the tools you used. Sometimes it is preferable to update your code and use a newer version of the tool than to keep an old bugged version or forget the improvements.

I have never tested but on another post I read that environments are self contained in one folder, $CONDA_HOME/envs/[your_env] and that this folder can be copied directly in another conda installation if it's the same architecture (linux64,windows,OSX...).

Q3: There is no tool for this apart from the conda env export. By the way, I think all downloaded packages are in $CONDA_HOME/pkgs.

Q4: No, since it is a not a good way to export your environments. For information, conda does not download multiple times the same packages for different environments. It reuses the already installed packages. You have the possibility to add a file called .condarc in your home and put in that file allow_softlinks: false. This will tell conda to reinstall any package needed in the installation of a new environment and not to link the tools already installed in other envs.

更多推荐

conda,spec,文件,bz,电脑培训,计算机培训,IT培训"/> <meta name="description&

本文发布于:2023-08-04 02:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1405899.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   CondaHTTPError   HTTP   file   Create

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!