2.4. Option #2 – Anaconda¶
2.4.1. Installing Anaconda and external packages¶
If you are using the pre-built CODAS Virtual Computer, you can skip this step.
This section describes the installation of Anaconda on your own computer, to provide Matplotlib, Numpy, and other third-party code. You still need to install CODAS software after this step.
These instructions for installing Anacondas are specific to a reasonably recent Mac and have been tested on Xubuntu 18.04 Linux host, but most of the steps will be similar on other machines. Some notes about other platforms are included. The Anaconda software distribution provides platform-independent package management for Python and other software in self-contained user-specific environments.
The instructions also assume that you are installing most things from scratch; if you have remnants of earlier installations or attempts, conflicts could occur, and these can be very confusing and difficult to track down.
Instructions for Anaconda installation change about every 6-12 months so it is possible you will run into trouble. If so, let us know. Maybe we have some insight.
Note
This documentation is for Python 3. Get the Python 3 installer.
(1) Install Miniconda
We have switched from using an Anaconda install to a Miniconda install follwed by creation of a tailored environment. That makes it easier to remove, start over, or experiment, if necessary.
We are not supporting the older Python2 versions of our software,
so download the Python 3 installer. Use the the default location for
installation, which will be a miniconda3
subdirectory in your home
directory. When the installation has finished, you will have an
extensive Python-based suite of software.
To begin, install the latest version of Miniconda that matches your operating system.
Download the Miniconda installer (eg.
Miniconda3-latest-Linux-x86_64.sh
)Find it, then run this (or equivalent) in a bash commandlone terminal:
bash Miniconda3-latest-Linux-x86_64.sh
The installer will have put the miniconda3/bin
subdirectory at the head
of your PATH
environment variable in your .bash_profile
. When you
start a new terminal session, it should therefore find the Miniconda
versions of python, ipython, etc.
One of the new commands that will be found in
miniconda3/bin
is conda
, which is the package management tool
(link to conda user guide).
We use this to install additional packages.
(2) Install additional Miniconda packages
Start a new terminal now, to use the new miniconda/bin
path.
Note
We are working in the miniconda “base” environment. We will now create a “pycodas” environment.
First, verify that conda
is coming from the ~/miniconda3/bin/conda
location. Type
which conda
to verify that it matches the name
echo ~/miniconda3/bin/conda
Run the following commands to install what we need:
conda config --add channels conda-forge
conda config --set channel_priority strict
conda config --set auto_activate_base false
conda config --append create_default_packages ipython \
--append create_default_packages pip \
--append create_default_packages "blas=*=openblas"
conda create -n pycodas python=3.7 basemap netcdf4 future pkgconfig pyqt qtconsole
Note
Every time you want to use the new environment, be sure to type:
conda activate pycodas
You can put this in your .bashrc so every terminal starts with this environment.
(3) Install Mercurial
For OSX, install the Mercurial package directly from the origin; it will work with the Python 2 version that is included with OS X. (In general, it is best not to install packages into the OS X Python; this is an exception.)
(4) Install a C compiler (OS X only)
For OSX, you will need the Apple C compiler. You can get it on line by installing all of Xcode (it’s huge), and then the command-line tools, or you can just install the latter directly. To get the command-line tools alone, invoke:
xcode-select --install
On Linux, the C compiler (gcc) is usually installed by default and is always available from the native package manager. At this time, native Windows builds are not supported. Your onnly choice on Windows is to use the virtual computer.
(6) Install CODAS software
Now you are ready to install CODAS software