Useful Anaconda Commands You Should Know About
conda list
— Will show you every package that your active conda env has installed. This is extremely useful if you installed a bunch of things that you no longer need, you can simply look for them in the list, and add them to your conda uninstall
command.
conda env list
— This is very similar to the above, except that it will show you all of the different conda envs that you’ve created. If you have an active environment, it will be denoted with a star (*) next to it.
conda create --clone envToClone --name envToCreate
— I had no idea you could clone conda envs when I first started, and boy would it have made my life easier. This will fully copy all of the packages you’ve installed in envToClone into a new environment called envToCreate.
conda list --revisions
— Conda automatically keeps a package history as you alter your environment, also known as “revisions”. This command will display each revision you’ve made to your conda env, which packages you updated, which you installed, which you deleted, etc… this is extremely useful when using the next command.
conda install --revision revisionNumber
— So the above command gave us the different revisions of our conda env, but this command will actually re-instate that particular revision for us! It also has the added benefit of not being destructive, so your revision history will continue along as if nothing happened, and just append the new revision to the end of that revision list.
conda list --explicit > my-env.txt
— This command will save your current conda env to a text file called my-env.txt, so that you can use it later on, give it to a coworker, or include it in your repo for ease of use later!
conda env create --file my-env.txt
— This command is for creating a new env using the my-env.txt file from above.
Questions?
You can find me on:
- GitHub: https://github.com/bengejd/
- Medium: https://medium.com/@JordanBenge
- Twitter: https://twitter.com/J_Benge13
Who am I? My name is Jordan Benge, I am a Software Developer who loves helping others and contributing to Open-Source whenever possible. I like to write up guides on how to do things that interest me that aren’t completely covered elsewhere.