Skip to content

Instantly share code, notes, and snippets.

@misho-kr
Last active July 22, 2019 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save misho-kr/541edc4de148414d83d4bd104f9218f4 to your computer and use it in GitHub Desktop.
Save misho-kr/541edc4de148414d83d4bd104f9218f4 to your computer and use it in GitHub Desktop.
Summary of "Conda Essentials" course at DataCamp.Com

Summary

Conda packages are files containing a bundle of resources: usually libraries and executables, but not always. In principle, Conda packages can include data, images, notebooks, or other assets.

One of the powerful aspects of conda, both the tool and the package format, is that dependencies are taken care of. That is, when you install any Conda package, any other packages needed get installed automatically.

A Conda package, then, is a file containing all files needed to make a given program execute correctly on a given system.

Packages

Installing a package is largely a matter of listing the name(s) of packages to install after the command conda install. But there is more to it behind the scenes. The versions of packages to install (along with all their dependencies) must be compatible with all versions of other software currently installed.

Software is labeled with a three-part version identifier of the form MAJOR.MINOR.PATCH

  • Updating and removing packages

Channels

An identifier of a path (e.g., as in a web address) from which Conda packages can be obtained.

  • Searching conda search
  • Searching across channels with anaconda
  • The default channel on Anaconda Cloud is curated by Anaconda Inc.
  • Another channel called conda-forge also has a special status. It acts as a kind of "community curation" of relatively well-vetted packages. The GitHub page for the conda-forge project os at https://github.com/conda-forge

Environments

Conda environments allow multiple incompatible versions of the same (software) package to coexist on your system. An environment is simply a filepath containing a collection of mutually compatible packages.

Without the concept of environments, users essentially rely on and are restricted to whichever particular package versions are installed globally (or in their own user accounts) on a particular machine.

  • conda env list
  • conda list displays all packages installed in the current environment
    • query for specific packages by passing package names
    • query a different environment's configuration with --name <env>
  • Switch between environments with activate and deactivate
  • conda env remove --name <env>
  • conda create --name recent-pd python=3.6 pandas=0.22 scipy statsmodels
  • Export an environment with conda env export
  • Create an environment from a shared specification with conda env create -f <env-spec.yml>

Case Study

  • Compatibility with different versions

A common case for using environments is in developing scripts or Jupyter notebooks that rely on particular software versions for their functionality. Over time, the underlying tools might change, making updating the scripts worthwhile. Being able to switch between environments with different versions of the underlying packages installed makes this development process much easier.

  • Updating a script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment