1

I downloaded Anaconda and started using it on my Mac but now I am switching laptops. I will be using a Windows laptop now and I need to transfer my environments to my new laptop. How best can I do this?

I am using Python version 3.8 and was using Jupyter notebooks to run my code. But if I simply try to run the notebook on my Windows laptop I am getting one error after another (because I don't have the packages installed). Installing them one by one will take time and I don't even remember most of what I installed.

merv
  • 67,214
  • 13
  • 180
  • 245
Denise
  • 153
  • 3
  • 15
  • Does this answer your question? [How to transfer Anaconda env installed on one machine to another? \[Both with Ubuntu installed\]](https://stackoverflow.com/questions/45864595/how-to-transfer-anaconda-env-installed-on-one-machine-to-another-both-with-ubu) – AMC Oct 02 '20 at 00:02
  • Does this answer your question? [How to share conda environments across platforms](https://stackoverflow.com/questions/39280638/how-to-share-conda-environments-across-platforms) – neves Oct 23 '20 at 15:30

1 Answers1

5

If you are working across platforms (osx-64 -> win-64) you'll need to be minimal about what packages you export from the existing environment. While Conda does have a recommended intra-platform procedure for exactly recreating environments, it does not directly translate to the cross-platform situation. Instead, try using:

conda env export --from-history > environment.yml

and then, on the new computer,

conda env create -f environment.yml

This will only export the packages that you have explicitly specified to be in the environment at some point (e.g., using conda install foo). Dependencies will be resolved automatically on the new system. This does not guarantee there still won't be packages that aren't available on Windows, but they should be less frequent and easier to resolve manually (typically by removing them from the YAML or adjusting versions).

merv
  • 67,214
  • 13
  • 180
  • 245
  • i got the following error while creating new environment `ResolvePackageNotFound: - hdbscan - python.app` so do i delete these and run again? it won't disrupt anything? – Denise Sep 30 '20 at 18:44
  • @Denise Generally, try searching Anaconda Cloud for packages that don't install. For [hdbscan](https://anaconda.org/search?q=hdbscan), it shows a **win-64** version is available, but you may need to add the **conda-forge** channel to the YAML; for [python.app](https://anaconda.org/search?q=python.app), that is specific to Mac, so it can be deleted. And yes, rerun after changes. – merv Sep 30 '20 at 19:42