Reputation: 704
I have a list of several conda environment that I am using for different projects. For example:
└[3417]± conda env list
# conda environments:
#
base /????/anaconda2
analysis_eel_data * /????/anaconda2/envs/analysis_eel_data
explore_cora /????/anaconda2/envs/explore_cora
pygmt /????/anaconda2/envs/pygmt
python3 /????/anaconda2/envs/python3
test_cookiecutter_pj1 /????/anaconda2/envs/test_cookiecutter_pj1
I was wondering if there is an 'easy' way to install the same package in several conda environments?
By easy, I mean a solution that could hold in one or two command lines?
Correct me if I am wrong, I think that [I was wrong]pip
could be a solution if I want the new package install in all my environments?
I am also open for a solution using pip
if it is easier than conda
I didn't find anything on this in the conda documentation
Upvotes: 0
Views: 1010
Reputation: 7744
There's no inbuilt functionality of conda
to do this. The simplest way is to write a bash/shell
script that can install the package of your interest in multiple environments.
We can find the path of your env
using the command conda env list
. Using this, the script would look something like this
for env in $(conda env list);
do conda install -n $env <package_name>;
done
Also, note that this will install it in every env
and not equivalently the same as several
as you mentioned. In this case, we would simply need an if-conditional
to determine to install in that env
or not.
Upvotes: 1