4 min to read
Basic Tutorials Part 3
Basic Tutorials Part 3
Conda is an open source package management system and environment management system that runs on Windows, macOS and Linux.
Conda quickly installs, runs and updates packages and their dependencies. Conda easily creates, saves, loads and switches between environments on your local computer. It was created for Python programs, but it can package and distribute software for any language.
Another point worth mentioning is, Open Source projects share their ‘source’ code; which needs to be compiled everytime you want to use it. However, compiling a huge library can be tedious and time taking. Conda provides precompiled libraries to be downloaded whenever you need to install something new. So you just have to download it and can dive right in!
A detailed tutorial of using Conda and Jupyter notebooks will be shared in Part-1 of this series.
Package managers are used to install libraries and other software on your computer. Pip is the default package manager for Python libraries.
Conda is similar to pip except that the available packages are focused around data science while pip is for general use.
However, conda is not Python specific like pip is, it can also install non-Python packages but it does include all the Python packages and supports pip.
While creating a Project, you will require various libraries and dependencies. Some projects will require a certain set of libraries which will work only with a given version of a set of other libraries, but at the same point you might want to work on a different set of projects.
To help with this, Conda creates separate ‘environments’. A environment X with a set of libraries is independent and unaffected by another environment Y. Thus you can work on your given projects without worrying about ‘breaking’ the requirements everytime you install something-when you do, conda ensures that the ‘environment’ works in cohesion by changing other libraries.
Conda is the package of Anaconda. If you’ve used virtual env, pip: it includes both of these functionalities along with a few extra.
We will use conda because we’re geeks. Just kidding, conda will be required when you need to access a cloud instance since you won’t have access to GUI. Plus, it’s easier to type 1 command than click a few buttons (Okay, maybe I wasn’t kidding about the geekiness).
Anaconda navigator which serves as a GUI to the Conda package and includes it is supported on Linux, OS X and Windows.
You can download the Navigator from Here
Select your OS and follow the Steps. These are pretty basic and have been omitted. If you’re stuck anywhere or need help, please ask us in the comments below.
The commands below are to serve as a syntax. We’ve create a Github repository for you to use. Feel free to use the code from there
Github repository link (Link to be updated soon)
- Creating an environment:
conda create -n env_name list of packages
- Using an environment
To use an environment:
source activate envname Windows: actiavte envname
Notice that your prompt has a (envname) before it.
To get out of an environment:
- To install packages
source activate envname conda install packagename
- Sharing requirements:
Your project has a certain set of required libraries in order to work. When sharing your project, you share your requirements file so that one can create an environment directly from these.
conda env export > environment.yaml
This creates a YAML file that contains the list of dependencies of the project.
- To create an environment using a YAML file:
conda env create -f environment.yaml
This creates a new environment with the name as is - inside the YAML file.
- To remove an environment
conda env remove -n env_name
- To list all the environments inside your machine
conda env list
This is by no means an exhaustive list of the commands. These are meant to serve for an introductory purposes.
Checkout the Conda user guides if you want to learn more.
Here is another interesting read Common Myths and Misconceptions
If you have any problems running our code or want to discuss anything drop a comment below!
Subscribe to my weekly-ish [Newsletter](https://tinyletter.com/sanyambhutani/) for a set of curated Deep Learning reads