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 --all
It clean tarballs garbage create by environments and clean disk spaceconda update <package_name>
update a package inside environmentconda list
list packages inside the environmentconda install -n <env_name> pandas
Install 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.1
install package inside an environmentconda
Environment commandsconda env list
list the available environmentsconda create --name <env_name> python
Createconda
environmentconda create -n <env_name> python=3.7
Create a environment based on Python 3.7conda activate <env_name>
Activate the environmentconda deactivate
Deactivate the current environment
To reproduce the project including environment, conda
has environment files. conda
calls it environment files.
conda env export --file environment.yml
export the current environment to the current working directoryconda env create -n <env_name> environment.yml
recreate 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 myEnv
conda activate myEnv
conda install -c anaconda ipykernel
python -m ipykernel install --user --name=myEnv
Shuvangkar Das, Potsdam, New York
Leave a comment