How to use Anaconda to manage packages and environments
Published in
2 min readMay 25, 2019
A concise list of useful conda commands
Background
Inside and outside of work, Anaconda has been an essential tool for me to manage packages and environments. In a nutshell, Anaconda is a distribution of packages specialized for Data Scientists. The package and environment manager for Anaconda is called conda.
why conda?
So don’t we just usepip
, another popular package manager? There are couple of reasons that I can think of:
- Downloading anaconda takes some time and as of today, it occupies around half Gigabytes of data. This is because anaconda comes with pre-installed packages that most Data Scientists need.
- Not only can Anaconda be used as a package manager like
pip
, it also has the ability to manage environments likevirtualenv
orpyenv
.
Useful Commands
conda create -n environment_name python=3.x
where-n
means new,environment_name
should be replaced with the name of the environment,x
indicates the python version e.g.3.5, 3.6, 3.7
or even2.7
(but python 2 will soon be deprecated so please use3.x
)conda activate envrionment_name
to activate an environmentsource deactivate
orconda deactivate
to deactivate an environmentconda install package_name
orconda uninstall package_name
- one can also do
conda env export > environment.yaml
to export the environment, and useconda env create -f environment.yaml
to re-create that environment conda env list
to list all environmentconda env remove -n env_name
to remove a certain environment
Go Beyond
To learn more about useful conda
command, check out its official command reference:
Reference
[download anaconda] https://www.anaconda.com/download/.