Conda Cheatsheet
The conda is the command-line interface tool for managing installations of various packages in Anaconda. Of course, Anaconda has GUI to manage everything. Yet, GUI does not provide all the functionalities and automation facilities.
conda basic commands
conda clean --allIt clean tarballs garbage create by environments and clean disk spaceconda update <package_name>update a package inside environmentconda listlist packages inside the environmentconda install -n <env_name> pandasInstall package into an environment from default shellpip install <package_name>Install a package from python repo in the current environment.conda install pandas=0.24.1install package inside an environmentcondaEnvironment commandsconda env listlist the available environmentsconda create --name <env_name> pythonCreatecondaenvironmentconda create -n <env_name> python=3.7Create a environment based on Python 3.7conda activate <env_name>Activate the environmentconda deactivateDeactivate the current environment
To reproduce the project including environment, conda has environment files. conda calls it environment files.
conda env export --file environment.ymlexport the current environment to the current working directoryconda env create -n <env_name> environment.ymlrecreate an environment from the environment file form current directory
Note 1: If a package is not available on Anaconda Repository it can be installed from the python default repository using pip. It is also mentioned that pip does not possess all the features of conda packages.
Note 2: It is recommended to install all the packages we want to include in an environment at the time of environment creation. It helps avoid dependency conflicts.
Add conda environment to jupyter notebook
conda create --name myEnvconda activate myEnvconda install -c anaconda ipykernelpython -m ipykernel install --user --name=myEnv
Shuvangkar Das, Potsdam, New York
Leave a comment