2

Is it possible to create an anaconda environment with all of the packages from my other environments? It would be even better if it could dynamically stay up to date.

Adam_G
  • 7,337
  • 20
  • 86
  • 148

2 Answers2

2

If the packages of interest were all pulled from pip you could attempt a pip freeze and requirements install like discussed here.

Pip freeze vs. pip list

But I doubt that would work globally for every module. I remember back in the day trying to extend my base python to include Bokeh, but all the dependency headache eventually caused me to outright install Anaconda.

Looks like there is a means to do this,

$ conda list -e > req.txt

then you can install the environment using

$ conda create -n new environment --file req.txt

These examples are for one off merging of a single source to a single target environment. If you want the union of various environments you'd need to merge the req.txt files and possibly take the highest value version so you'd need to do some string parsing and a little bit of scripting so you don't get conflicting versions installed from various environments funneling down to one. (I'm not able to test this directly at the moment)

jxramos
  • 7,356
  • 6
  • 57
  • 105
1

stack 'em.

create environments for base_env (base packages) and app_env (just your application packages)

then,

conda activate base_env

conda activate --stack app_env

carlsborg
  • 2,628
  • 19
  • 21