2

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!

merv
  • 67,214
  • 13
  • 180
  • 245
R. James
  • 21
  • 2
  • 1
    If you never `clean`ed the old installation, you can maybe go to the `C:\Anaconda2\pkgs` or similar directory, copy the relevant `.tar.bz2` files to the new computer and do `conda install -f package-file-name.tar.bz2`. You'll have to do the packages one-by-one though – darthbith Dec 06 '18 at 01:41
  • Perhaps try removing the build specifications: `conda env export --no-builds > myenv.yaml` – merv Dec 06 '18 at 17:45

0 Answers0