Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can conda install package globally or are all package installed to a specific environment?

I have multiple environments under my conda management, as shown below

ss-MacBook-Pro$ conda env list
# conda environments:
#
base                  *  /miniconda2
testenv                  /miniconda2/envs/testenv
testenvpy3               /miniconda2/envs/testenvpy3

Can I install a package that becomes effective across multiple environments? By reading the documentation, I got the impression that it is NOT possible, because if I do

conda install package-name

it will only get installed into the base environment (the current active environment), but it does not apply to other environments. I remember I can somehow achieve install a package effective to multiple environments under virtualenv before.

Can someone share the suggestion?

like image 442
chen Avatar asked Jan 07 '19 01:01

chen


1 Answers

conda install only installs packages for the current (activated) environment. Files will be installed in the directory for the specific environment. If you want a specific package in all environments, you'll have to conda install that package for each of your environments (base, testenv, testenvpy3).

To switch between environments you just need to activate the one you switch to. The syntax depends Anaconda version or your OS. For newer Anaconda versions, conda activate <env name> works, and for older versions, source activate <env name> for Unix systems and activate <env name> for Windows.

I'm sure you've looked at this already, but here's a helpful link.

like image 57
busybear Avatar answered Oct 15 '22 04:10

busybear