What the f*** is conda
Install conda.
Install miniconda. Pick Linux > Miniconda3 Linux 64-bit unless you are a little baby. Say yes to conda init.
Fix default things that conda does
- Close your terminal and open another, or source ~.bashrc or wherever you have bashrc.
- Prevent conda from activating base environment by default
conda config --set auto_activate_base false
- Checkout base packagesIf you had installed anaconda, you’d have 6 million base packages. For some reason, conda geniuses install conda inside the base environment, so we can’t actually delete it.
conda list
- Checkout environmentsOh, it’s only the base environment. Let’s make a new one.
conda env list
Create your first environment
conda create -n environment_name_here
Make sure you created your environment.
conda env list
An environment is a place where you install packages, use them, and get out. If you install a package inside an environment, you cannot use it outside of the environment (provided you have not also installed it outside of the environment globally with pip or something).
In order to use an environment, or get inside of it, you can activate it.
Activate your first environment
conda activate environment_name_here
Now you will see your environment name on your terminal prompt. Check out the packages installed in your environment.
conda list
Should be empty.
Install your first package
conda install numpy
conda might ask to install dependencies. Say yes.
List packages. See numpy.
Test it out by importing numpy in python (an interactive prompt, a script, or a noteboook).
Deactivate environment
conda deactivate
Now, if you did not have numpy installed globally, you can check your base packages and see that numpy is not installed. This is essentially the beauty of conda.
Share my conda environment with a friend (or just save it to use on another machine if you are lonely)
conda env export -n environment_name_here -f filename.yml
Create conda environment from yml file
Let’s test on your machine. Let’s delete your environment, then reinstall from the file you just exported.
Remove conda environment
conda env remove -n environment_name_here
Create conda environment from yml file
conda env create -n env_name -f filename.yml
Make sure it’s there
conda list
Seems like that’s about it.