How to clone an old python conda environment (when links to packages no longer work)

我的未来我决定 提交于 2021-02-10 17:20:52

问题


I have a new PC and I want to clone a Python environment from my older computer.

I created the Python environment about two years ago using Anaconda 2 for Python 2.7. I am having trouble copying it exactly, because some of the packages are no longer available in the same versions and locations. I want to know if there is a way to copy the environment directly from one computer to another, rather than installing each package from a weblink (that in some cases no longer exists).

I have tried several methods to copy it to my new computer including:

  1. running the same installs I did the first time

  2. creating a txt file of all the package sources using:

    conda list --explicit > spec-file.txt

    on the old computer and then:

    conda create --name myenv --file spec-file.txt

    on the new computer

  3. creating a yml environment file using:

    conda env export > environment.yml

    on the old computer and then:

    conda env create -f environment.yml

    on the new computer

All of these three options fail because some of the packages can no longer be found at the original links. Of course, I can install the new versions of the packages, but the dependencies are different and I am having trouble restoring the same functionality.

I have found one similar post on this topic, noting "this issue seems to defeat the purpose of saving the environment in the first place"! But no one has yet suggested a solution.

Any advice greatly appreciated. Thank you!

来源:https://stackoverflow.com/questions/53639076/how-to-clone-an-old-python-conda-environment-when-links-to-packages-no-longer-w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!