Conda is an environment manager, which allows you to manage a set of library dependencies specific to each of your projects. Here are the type of issue that is addresses:
- some of your projects might require installing TensorFlow while others don't.
- one project might require an old library which itself depends on older versions of numpy, but you don't want to be locked into using this old version of numpy across all your projects.
- your project might depend on some external libraries which has plaftorm specific code. The manager will resolve to the correct dependency on each platform, making your code very portable.
The way conda will manage this is by maintaining independent python environment. Requirements can be described into an environment file that you can then use to set up your environment anywhere.
This is a quick tutorial on using conda files. I sill start with a simple cheatsheet, here is a more complete one: conda cheatsheet
# show infos about current env conda info # create environment from file conda env create -f environment.yml # activate the environment (you might replace this with selecting it directly) conda activate <env-name> # lists installed packages conda list # install package conda install <package name> # update conda conda update -n base conda
Environment file example
You can store the following into
environment.yml. It describes a
my-env environment on your computer.
name: my-env channels: - defaults - conda-forge dependencies: - python=3.8 # or 2.7 if you are feeling nostalgic - numpy - matplotlib - pandas - seaborn
For now I am simply going to refer to conda installation