5

I imported an anaconda environment from another machine. I want to install the packages from imported environment into root or make the imported environment as default. Is there any way to either 1. import all the packages from one environment to another? OR 2. Use non-root environment as default environment?

Note: both environments are for python 2.7.

PyRaider
  • 607
  • 4
  • 11
  • 21

1 Answers1

8

First export the environment from one machine:

$ conda env export -n myenv -f myenv.yml

Then create a new environment from myenv.yml on the other machine:

$ conda env create -f myenv.yml

To use this environment as default, add source activate myenv to your .bashrc.

harryscholes
  • 1,617
  • 16
  • 18
  • that file was in GITHUB folder, is that correct? ...Also, how do I verify what is my current defualt env? – PyRaider Feb 08 '17 at 02:05
  • `myenv.yml` could be in a Git repo. Copy it from one machine to the other via your preferred method. `conda env list` shows all environments and indicates the current environment. – harryscholes Feb 08 '17 at 07:48
  • @PyRaider if my answer helped you, could you kindly accept it? – harryscholes Feb 11 '17 at 15:57
  • Is there anyway to do so when there's no access to internet? Like, I do have some packages installed on my **base** environment, which I want to also install on my **new_environment**. Is there a way to do that offline on the same machine? – Pedram Mar 02 '20 at 21:08