Conda environment 101

Sophia Yang, Ph.D.
3 min readMay 8, 2019

Conda is an open source package management and environment management tool for Python and other languages. Whenever you use Python, you will be working in a Python environment, which contains the specific Python version you are running on and various Python packages with specific package versions and specifications.

If you use Anaconda or Miniconda, you can easily use Conda to manage your Python environment. To see which environment you are currently on, run:

conda env list 

It always starts with the base environment, which could be /anaconda3 or /miniconda. For Anaconda users, your base environment will include a bunch of data science packages preinstalled, which is super handy and ready to use. However, it is recommended to always create and use your own environment and don’t use the base environment. I learned this lesson the hard way. If you break your base environment, you won’t be able to remove your base environment and you will have to uninstall and reinstall Anaconda/Miniconda completely. In addition, different projects requires different packages and versions of packages. To avoid such environment conflicts, we can just create different conda environment for different projects by running the following:

conda create --name myenv

or create an environment with a specific Python version:

conda create --name myenv python=3.7

Now conda env list should list the new environment you just created. To activate this new environment, simply run conda activate myenv and to deactivate run conda deactivate.

Once you are in your new environment, conda list lists everything installed in your environment. It should be empty now. For my new conda environment, I’d like to start with installing some basic packages I use every day for almost all my projects:

conda install jupyter notebook dask distributed fastparquet pandas

Then you can install additional packages to meet the needs of each project.

When install packages, try to use conda install and avoid pip install if possible. Although pip works in conda environment, conda works better for conda packages. If a package you are looking for is not in the conda default channel, please checkout the…

Sophia Yang, Ph.D.