What is Conda?
conda is an open source package and environment management system for installing multiple versions of software packages, their dependencies and switching easily between them. While it originally was developed to support Python, it now supports multiple languages. It works on Linux, OS X and Windows. This Aug. 2016 blog post from Jake Vanderplas provides nice clarifications about conda and where it fits in the ecosystem of Python packaging and environments. See also this Continuum Analytics blog post for a great, comprehensive introduction to conda targeted to data scientists; it also has links to a presentation (Youtube and slides) on the same material.
For additional help you can consult the UW GeoHack conda introduction.
Anaconda or Miniconda
Anaconda is a data science platform that comes with a lot of packages. At the core, Anaconda uses the conda package management system. A list of packages included can be found here. If you don't have time or disk space -- or the inclination -- to install the entire distribution, try Miniconda, a bootstrap version of Anaconda, which contains only Python, essential packages, and conda. Other packages have to be installed individually.
NOTE: We will be using Python 2.7 for this workshop.
- To install Anaconda, please click on the link below for your operating system, and follow the instructions on the site:
NOTE: FOR Windows and OSX Graphical installation, make sure to do a custom install and uncheck the box
url=https://repo.continuum.io/archive/Anaconda3-5.0.1-MacOSX-x86_64.sh curl $url -o anaconda.sh bash anaconda.sh -b export PATH=$HOME/anaconda/bin:$PATH conda update --yes --all
- Once Anaconda installation step is finished run
pythonin the command line to test if Anaconda is installed correctly. Note: For windows, please use Windows powershell as the command line. It should be preinstalled, if not click here. If Anaconda is installed correctly, you should have this prompt, which emphasizes Anaconda:
$ python Python 3.6.2 |Anaconda custom (x86_64)| (default, Dec 6 2016, 18:57:58) [GCC 4.2.1 (Apple Inc. build 5577)] on darwin Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org >>>
Navigate to https://conda.io/miniconda.html and download the proper installer for you Windows platform (32 or 64 bits). We recommend to download the Python 3 version of Miniconda. You can still create Python 2 environments using the Python 3 verson of Miniconda, so you are not limiting yourself.
When installing you will be asked if you wish to make the Anaconda Python your default Python for Windows. If you do not have any other installation that may be a good option. If you want to keep multiple versions of python on your machine (e.g. ESRI-supplied python, or both 32 and 64 bit versions of Anaconda), then don't select the option to modify your path or modify your Windows registry settings.
Linux and OSX
You may follow manual steps from https://conda.io/miniconda.html similar to the instructions on Windows (see above). Alternatively, you can execute these commands on a terminal shell (in this case, the bash shell):
url=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh # On MacOSX, replace Linux with MacOSX curl $url -o miniconda.sh bash miniconda.sh -b export PATH=$HOME/miniconda/bin:$PATH conda update --yes --all
odm2client conda environment
clientenvironment.yml file by going to this link, right clicking with the mouse and choosing
Open a terminal window where you saved the file and type the commands to create the environment and "activate" it.
conda env create -f clientenvironment.yml # Will create an environment called "odm2client" source activate odm2client # OSX and Linux activate odm2client # Windows
odm2client conda environment includes
yodatools, and other python packages that are useful to interact and work with the data and metadata from odm2 ecosystem, which include
owslib. The dependencies of each package will be handled automatically by the conda environment. Additional conda packages available in the environment include
nb_conda_kernels. These three packages allows for the ability to run jupyter notebook and being able to switch between conda environments within the notebook.
Starting Jupyter notebooks
On Windows and MacOSX you may have a conda GUI application already installed, specially if you installed Anaconda. That application should let you select the
odm2client environment, then launch Jupyter notebook with that environment.
Otherwise, on the command shell, you can launch Jupyter notebooks (after activating the environment) like this:
Removing and recreating the
odm2client conda environment
To delete the conda environment, first "deactivate" it if you've activated it in your shell session:
source deactivate # OSX and Linux deactivate # Windows
Then remove the environment:
conda env remove -n odm2client
You can create it again, from scratch, using the command described earlier.