How to install nctoolkit¶
You will need a Linux or Mac operating system for nctoolkit to work. It will not work on Windows due to system requirements.
The best and easiest way to install nctoolkit is to use conda. This will install all system dependencies, and nctoolkit will just work out of the box. This can be done as follows:
$ conda install -c conda-forge nctoolkit
Mamba is a smoother way to manage conda environments. If you don’t use it, you should try. Install it from here.
Once mambaforge is installed you can install nctoolkit as follows:
$ mamba install -c conda-forge nctoolkit
This will be much faster to install than using conda, because mamba resolves environments much faster.
Note that recent releases are not available on macOS on conda. This issue is being investigated at the minute, and will hopefully be resolved shortly. In the meantime, if you are using macOS, it is best to install using pip.
If you do not use conda, you can install nctoolkit using pip. The package is available from the Python Packaging Index. To install nctoolkit using pip:
$ pip install nctoolkit
This will install the core dependencies of nctoolkit. If you want slightly better plots, you can install all dependencies:
$ pip install nctoolkit[complete]
The “complete” version of nctoolkit partly relies on cartopy for plotting. This has some additional dependencies, so you may need to follow their guide here to ensure cartopy is installed fully. If you install nctoolkit using conda, you will not need to worry about that. Note: cartopy will automatically be installed in the conda version of nctoolkit. It is excluded as a core dependency on pypi because it can be difficult to install.
Once you have installed nctoolkit using pip, you will need to install the system dependencies listed below.
To install the development version from GitHub:
$ pip install git+https://github.com/r4ecology/nctoolkit.git
There are two main system dependencies: Climate Data Operators, and NCO. The easiest way to install them is using conda:
$ conda install -c conda-forge cdo $ conda install -c conda-forge nco
$ mamba install -c conda-forge cdo $ mamba install -c conda-forge nco
CDO is necessary for the package to work. NCO is an optional dependency and does not have to be installed.
If you are working on an Ubuntu system, you should be able to install CDO as follows:
$ sudo apt install cdo
If you want to install CDO from source, you can use one of the bash scripts available here.