User Tools

Site Tools


other:uvcdat:cdat_conda:cdat_8_0_py2

This is an old revision of the document!


CDAT 8.0 installation notes

[ Back to all versions ]

UV-CDAT is now the “Community Data Analysis Tools” (CDAT)

Follow the instructions about the conda-based versions of UV-CDAT initialization for actually using an installed version of 8.0

What's New?

Installation with Miniconda3

Installing Miniconda3

We have installed a new version of Miniconda3 (steps below adapted from the installing miniconda instructions)

  • Execute the installer
    • bash Miniconda3-latest-Linux-x86_64.sh
      • Accept the license
      • Specify an explicit installation path outside of the home directory, with enough disk space (more than 3G if you are going to install UV-CDAT and some extra packages), preferably on a disk that is not backed up:
        • Linux LSCE: /home/share/unix_files/cdat/miniconda3
        • Linux ciclad: /data/jypmce/cdat/miniconda3
        • WSL: installing to a directory that is not in /home/ does not work (e.g. /mnt/h/CDAT/miniconda3,assuming there is a H:\CDAT\ directory, does not work)
          Need to accept the installation in the default location: /home/jypeter/miniconda3
        • Resulting miniconda3 directory size is 302M
           >du -sh miniconda3
          302M    miniconda3
           >cd miniconda3
          /home/share/unix_files/cdat/miniconda3
           >du -sh *
          6.3M    bin
          2.0M    compiler_compat
          524K    conda-meta
          4.0K    envs
          28K     etc
          5.2M    include
          146M    lib
          8.0K    LICENSE.txt
          142M    pkgs
          928K    share
          92K     ssl
          12K     x86_64-conda_cos6-linux-gnu
      • Accept the automatic update of the PATH variable in .bashrc (note: the installer automatically creates a backup of .bashrc). This will some extra lines at the end of .bashrc used by the old-style conda initialization (we will later switch to the new-style). The added lines should look like:
        • # added by Miniconda3 installer
          export PATH=“/home/share/unix_files/cdat/miniconda3/bin:$PATH”
        • # added by Miniconda4.xxx installer
          [some really fancy bash shell commands]
  • Remove the installer: rm Miniconda3-latest-Linux-x86_64.sh
  • Open a new terminal (if you use bash) or open a new terminal and type bash
    • check if the python from the conda distribution has been correctly installed
       > bash
      $ which python
      /home/share/unix_files/cdat/miniconda3/bin/python
      $ which conda
      /home/share/unix_files/cdat/miniconda3/bin/conda
    • Update and clean the new installation
      $ conda update --all
      $ du -sh /home/share/unix_files/cdat/miniconda3
      515M    /home/share/unix_files/cdat/miniconda3
      $ conda clean --all
      $ du -sh /home/share/unix_files/cdat/miniconda3
      270M    /home/share/unix_files/cdat/miniconda3
      $ conda list
      # packages in environment at /home/share/unix_files/cdat/miniconda3:
      #
      # Name                    Version                   Build  Channel
      [...]
      python                    3.7.1                h0371630_3
      readline                  7.0                  h7b6447c_5
      requests                  2.20.0                   py37_0
      [...]

Post-Miniconda3 installation

The idea is to remove the miniconda3 initialization lines that were automatically added at the end of .bashrc and put them (and other useful commands) in a special initialization file, that can be sourced only when we actually want to use conda and CDAT (in order to avoid potentiel side effects)

New style initialization

Note: this is the new conda activate some_version style

See the ~jypeter/.conda3_jyp.sh file below, and how to use it, in a bash shell. In a tcsh shell, see the ~jypeter/.conda3_jyp.csh further down. In both shell cases, if you are installing your own version of python, you need to use your own location of the initialization files in the source lines, and you can use another file name than conda3_jyp

$ which python
/usr/bin/python

$ cat ~jypeter/.conda3_jyp.sh
# Conda initialization by JYP, NEW style
#
# Use this for working with conda and CDAT centrally managed by JYP
#
# Execute this file in a BASH shell with
#     source path/this_file
# Then get the list of available python distributions with
#     conda env list
# Then activate a specific distribution with
#     conda activate version_name
#
# More details in:
#   https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:python:starting#conda-based_versions_of_uv-cdat
#   https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:uvcdat:conda_notes
#
# Jean-Yves Peterschmitt - LSCE - 11/2018

source /home/share/unix_files/cdat/miniconda3/etc/profile.d/conda.sh

# Use the alias below to easily determine where your python
# interpreter is located
alias wp="which python"

# Where are ALL the python interpreters in the search path
alias wpa="which -a python"

# The end

$ source ~jypeter/.conda3_jyp.sh

$ conda activate
(base) $ which python
/home/share/unix_files/cdat/miniconda3/bin/python

tcsh shell usage example

 >which python
/usr/bin/python

 >cat ~jypeter/.conda3_jyp.csh
# Conda initialization by JYP, NEW style
#
# Use this for working with conda and CDAT centrally managed by JYP
#
# Execute this file in a TCSH shell with
#     source path/this_file
# Then get the list of available python distributions with
#     conda env list
# Then activate a specific distribution with
#     conda activate version_name
#
# More details in:
#   https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:python:starting#conda-based_versions_of_uv-cdat
#   https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:uvcdat:conda_notes
#
# Jean-Yves Peterschmitt - LSCE - 11/2018

source /home/share/unix_files/cdat/miniconda3/etc/profile.d/conda.csh

# Use the alias below to easily determine where your python
# interpreter is located
alias wp "which python"

# The end

 >source  ~jypeter/.conda3_jyp.csh

 >conda activate

(base) >which python
/home/share/unix_files/cdat/miniconda3/bin/python

You probably don't want to type the source line each time you need to use your conda based python, so you can add a source ~jypeter/.conda3_jyp.sh line in your ~/.bashrc file, and source ~jypeter/.conda3_jyp.csh line in your ~/.cshrc file. Then, when you need a specific python environment, just type conda activate name_of_the_specific_environment

Old style initialization

The old style notes below are just for reference sake and you can skip them

Note: this is the old source activate some_version style

See the ~jypeter/.conda3old_jyp.sh file below, and how to use it, in a bash shell

bash-4.2$ which python
/usr/bin/python

$ cat .conda3old_jyp.sh
# Conda initialization by JYP, OLD style
#
# Use this for working with conda and CDAT centrally managed by JYP
#
# Execute this file in a BASH shell with
#     source path/this_file
# Then get the list of available python distributions with
#     conda env list
# Then activate a specific distribution with
#     source activate version_name
#
# More details in:
#   https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:python:starting#conda-based_versions_of_uv-cdat
#   https://wiki.lsce.ipsl.fr/pmip3/doku.php/other:uvcdat:conda_notes
#
# Jean-Yves Peterschmitt - LSCE - 11/2018

export PATH="/home/share/unix_files/cdat/miniconda3/bin:$PATH"

# Use the alias below to easily determine where your python
# interpreter is located
alias wp="which python"

# Where are ALL the python interpreters in the search path
alias wpa="which -a python"

# The end

$ source ~jypeter/.conda3old_jyp.sh

$ wp
/home/share/unix_files/cdat/miniconda3/bin/python

Installing CDAT 8.0

Python 2.7 version

$ conda create -n cdat-8.0_py2 -c cdat/label/v80 -c conda-forge -c cdat python=2.7 cdat
# Generate the list of installed packages
$ conda list -n cdat-8.0_py2 > /home/scratch01/jypeter/cdat-8.0_py2_list_181108.txt

List of installed packages: cdat-8.0_py2_list_181108.txt

Disk space after 8.0 installation

$ du -sh /home/share/unix_files/cdat/miniconda3
4.3G    /home/share/unix_files/cdat/miniconda3
$ du -sh /home/share/unix_files/cdat/miniconda3/*
15M     /home/share/unix_files/cdat/miniconda3/bin
2.4M    /home/share/unix_files/cdat/miniconda3/compiler_compat
4.0K    /home/share/unix_files/cdat/miniconda3/conda-bld
3.7M    /home/share/unix_files/cdat/miniconda3/conda-meta
2.8G    /home/share/unix_files/cdat/miniconda3/envs
28K     /home/share/unix_files/cdat/miniconda3/etc
4.9M    /home/share/unix_files/cdat/miniconda3/include
156M    /home/share/unix_files/cdat/miniconda3/lib
8.0K    /home/share/unix_files/cdat/miniconda3/LICENSE.txt
1.4G    /home/share/unix_files/cdat/miniconda3/pkgs
1.3M    /home/share/unix_files/cdat/miniconda3/share
24K     /home/share/unix_files/cdat/miniconda3/ssl
12K     /home/share/unix_files/cdat/miniconda3/x86_64-conda_cos6-linux-gnu
$ du -sh /home/share/unix_files/cdat/miniconda3/envs/*
2.8G    /home/share/unix_files/cdat/miniconda3/envs/cdat-8.0_py2

Python 3.6 version

$ conda create -n cdat-8.0_py3 -c cdat/label/v80 -c conda-forge -c cdat python=3.6 cdat

Installing CDAT nightly

Notes:

  • This page is about CDAT 8.0, but we have added a short nightly section here as a convenient shortcut. This should probably be moved to a stand-alone nightly page later

Python 2.7 version

$ conda create -n cdat-nightly_py2 -c cdat/label/nightly -c conda-forge -c cdat python=2.7 cdat

Not tested! Can this be updated with conda update -n cdat-nightly_py2 -c cdat/label/nightly -c conda-forge -c cdat –all ???

Python 3.6 version

$ conda create -n cdat-nightly_py3 -c cdat/label/nightly -c conda-forge -c cdat python=3.6 cdat

Cloning cdat to add specific packages for LSCE

This section is about the creation of the cdatm17 environment

Notes about actually using the cdatm17 conda-based python

Note: using hard links, cloning a full environment only adds an extra 582M of disk space

$ conda create -n cdatm17_py2 --clone cdat-8.0_py2
Source:      /home/share/unix_files/cdat/miniconda3/envs/cdat-8.0_py2
Destination: /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2
Packages: 226
Files: 3

[...]

$ du -sh /home/share/unix_files/cdat/miniconda3/envs/*
2.5G    /home/share/unix_files/cdat/miniconda3/envs/cdat-8.0_py2
392M    /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2
839M    /home/share/unix_files/cdat/miniconda3/envs/cdat-nightly_py2

cdat nightly case

conda create -n cdatm-nightly_py2 --clone cdat-nightly_py2

Getting ready for a moving default CDAT

This step should probably be listed at the end, especially in a multi-user environment! If there is already a cdatm link, make sure that the new version is stable and working correctly before updating the cdatm link

We create a cdatm symbolic link in the envs directory, that has a stable name but can be moved to point to the latest default CDAT. In that case, most users can just activate this cdatm version and always get the latest stable version

$ cd /home/share/unix_files/cdat/miniconda3/envs
$ conda env list
base                  *  /home/share/unix_files/cdat/miniconda3
cdat-8.0_py2             /home/share/unix_files/cdat/miniconda3/envs/cdat-8.0_py2
cdatm17_py2              /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2
$ ln -s cdatm17_py2 cdatm
$ conda env list
base                  *  /home/share/unix_files/cdat/miniconda3
cdat-8.0_py2             /home/share/unix_files/cdat/miniconda3/envs/cdat-8.0_py2
cdatm                    /home/share/unix_files/cdat/miniconda3/envs/cdatm
cdatm17_py2              /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2
$ source activate cdatm
(cdatm) bash-4.2$ conda env list
base                     /home/share/unix_files/cdat/miniconda3
cdat-8.0_py2             /home/share/unix_files/cdat/miniconda3/envs/cdat-8.0_py2
cdatm                 *  /home/share/unix_files/cdat/miniconda3/envs/cdatm
cdatm17_py2              /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2

Customizing UV-CDAT for LSCE

Downloading cdms2/vcs test data

You should download the test data (174M of data…) and use it in the example scripts that you want to distribute, and scripts you write for reporting the errors you find (if any…)

$ source activate cdatm17_py2

(cdatm17_py2) $ python -c 'import vcs; vcs.download_sample_data_files(); print "\nFinished downloading sample data to", vcs.sample_data'
[...]
Finished downloading sample data to /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2/share/uvcdat/sample_data

(cdatm17_py2) $ du -sh /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2/share/uvcdat/sample_data
174M    /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2/share/uvcdat/sample_data

Packages that have no dependency problems

After cloning, we are ready to install some extra packages that may be requested by LSCE users

  • We first try to install together as many packages as possible that don't require other channels than conda-forge, and that don't request a downgrade of what is already installed
  • We then install individual extra packages with conda install or pip install
# Keep a trace of what will be installed
$ conda install --dry-run -n cdatm17_py2 -c conda-forge pillow pandas statsmodels seaborn scikit-image seawater gsw netcdf4 pyferret basemap-data-hires xlsxwriter cmocean rpy2 gdal windspharm  > /home/scratch01/jypeter/lsce-extra_01_install_190304.txt

# Install...
$ conda install -n cdatm17_py2 -c conda-forge pillow pandas statsmodels seaborn scikit-image seawater gsw netcdf4 pyferret basemap-data-hires xlsxwriter cmocean rpy2 gdal windspharm
[...]

# Install extra packages in the nightly version (if you need 'nightly')
$ conda install -n cdatm-nightly_py2 -c conda-forge pillow pandas statsmodels seaborn scikit-image seawater gsw netcdf4 pyferret basemap-data-hires xlsxwriter cmocean rpy2 gdal windspharm

# Check the disk space after installation
$ du -sh /home/share/unix_files/cdat/miniconda3
7.5G    /home/share/unix_files/cdat/miniconda3

$ du -sh /home/share/unix_files/cdat/miniconda3/envs/*
2.5G    /home/share/unix_files/cdat/miniconda3/envs/cdat-8.0_py2
1.2G    /home/share/unix_files/cdat/miniconda3/envs/cdatm17_py2
938M    /home/share/unix_files/cdat/miniconda3/envs/cdatm-nightly_py2
450M    /home/share/unix_files/cdat/miniconda3/envs/cdat-nightly_py2

List of installed packages: lsce-extra_01_install_190304.txt

Packages installed with pip

  • dreqPy: CMIP6 Data Request Python API
    • pip install dreqPy
    • Update with: pip install --upgrade dreqPy
      • Get version number with:
        $ drq -v
        dreqPy version 01.00.29 [Version 01.00.29]

The following packages have no dependency problems and were installed (or updated) later

  • vacumm: Validation, Analysis, Comparison - Utilities written in Python to validate and analyze Multi-Model outputs, and compare them to observations
    • conda install -n cdatm17_py2 -c conda-forge -c vacumm vacumm
  • spanlib: Spectral Analysis Library
    • conda install -n cdatm17_py2 -c stefraynaud -c conda-forge spanlib
    • Test: python -c 'from spanlib.analyzer import Analyzer'

TODO

Add here packages that would be useful and have not been installed yet, or have some problems that prevent their installation

  • iris: A Python library for Meteorology and Climatology
    • conda install -n cdatxxx -c conda-forge iris
  • wrf-python: A collection of diagnostic and interpolation routines for use with output from the Weather Research and Forecasting (WRF-ARW) Model
    • conda install -n cdatxxx -c conda-forge wrf-python
  • glances: a cross-platform monitoring tool (similar to top)

Other packages

There is no warranty that the packages listed below will work correctly, because it was required to bypass the compatibility checks in order to install them…
  • NO such packages now!

Updating some packages

Some packages change more often than others, and can be easily updated the following way:

    • Update with: conda update -n cdatxxx -c conda-forge -c pcmdi -c uvcdat cmor
      • Get version number with: python -c 'from cmor import *; print CMOR_VERSION_MAJOR, CMOR_VERSION_MINOR, CMOR_VERSION_PATCH'
    • Update with: pip install --upgrade dreqPy
      • Get version number with: drq -v

Installing CLIMAF

The CLIMAF installation is a special case, because we may want to use it with the Python installed for CDAT, but it is not installed using conda

We follow the steps for the installation of a non-standard server

  • Go to the appropriate installation directory (we choose the directory where we have also installed miniconda3):
    • LSCE: cd /home/share/unix_files/cdat
    • ciclad: /data/jypmce/cdat/
  • Add CLIMAF to the PYTHONPATH environment variable
    • LSCE & tcsh: setenv PYTHONPATH ${PYTHONPATH}:/home/share/unix_files/cdat/climaf
    • LSCE & bash: export PYTHONPATH=${PYTHONPATH}:/home/share/unix_files/cdat/climaf
    • ciclad: same as above, using /data/jypmce/cdat/climaf
  • Test the installation
    • make sure the Requirements are available:
      • LSCE: module load netcdf/4 nco cdo ncl ncview
      • ciclad: module load netcdf4 nco cdo ncl/6.3.0
      • optional: start an X server
      • cd climaf/testing
        ./test_install.sh
  • Once the tests are OK, add the required module load and environment variables definitions to the .basrc and .cshrc files. Note: maybe these lines should go to the .profile and .login files…(check Bash Startup Files)
    • LSCE: add to your .cshrc
      • # Prerequisites for using CLIMAF
        module load netcdf/4 nco cdo ncl ncview
        
        # CLIMAF environment variables
        setenv CLIMAF /home/share/unix_files/cdat/climaf
        setenv PYTHONPATH "${PYTHONPATH}:${CLIMAF}"
        #setenv PYTHONPATH $CLIMAF
        setenv PATH "${PATH}:${CLIMAF}/bin"
        setenv CLIMAF_CACHE "/home/scratch01/${USER}/climaf_cache"
        setenv TMPDIR $CLIMAF_CACHE
        setenv CLIMAF_LOG_DIR $CLIMAF_CACHE
        
        #conda activate cdatm-nightly_py2
    • ciclad: add to your .bashrc
      • # Prerequisites for using CLIMAF when not using the 
        # default 'module load climaf'
        module load netcdf4 nco cdo ncl/6.3.0
        
        # CLIMAF environment variables
        export CLIMAF=/data/jypmce/cdat/climaf
        #export PYTHONPATH=$PYTHONPATH:$CLIMAF
        export PYTHONPATH=$CLIMAF
        export PATH=$PATH:$CLIMAF/bin
        export CLIMAF_CACHE=/data/jypmce/climaf_cache
        export TMPDIR=$CLIMAF_CACHE
        export CLIMAF_LOG_DIR=$CLIMAF_CACHE
        
        #conda activate cdatm-nightly_py2
  • Open a new shell and run the tests again. If there is an error that was not there, check what you have added to the shell init files

Cleaning up things

Some packages may have files that can only be read by the person who installed CDAT and the LSCE extensions (eg pcmdi-metrics in 2.8.0 and cdp in 2.10)

We check if some of the installed files are missing read access for the group or other, and we manually change the permissions

 >find /home/share/unix_files/cdat/miniconda3/envs \! -perm /g+r,o+r -ls
# Everything OK!

Extra packages list

  • pillow: the friendly PIL (Python Imaging Library) fork
  • pandas: Python Data Analysis Library
  • statsmodels: a Python module that allows users to explore data, estimate statistical models, and perform statistical tests
  • seaborn: statistical data visualization
  • scikit-image: image processing in Python
  • seawater: Python re-write of the CSIRO seawater toolbox
  • gsw: Python implementation of the Thermodynamic Equation Of Seawater
  • vacumm: Validation, Analysis, Comparison - Utilities written in Python to validate and analyze Multi-Model outputs, and compare them to observations
  • netcdf4: a Python interface to the netCDF C library
  • pyferret: Ferret encapsulated in
  • basemap-data-hires: high resolution data for basemap
  • PCMDI metrics package (PMP): objectively compare results from climate models with observations using well-established statistical tests
  • XlsxWriter: a Python module for creating Excel XLSX files
    • Note: this is a dependency of dreqPy
  • dreqPy: CMIP6 Data Request Python API
  • CMOR: CMOR (Climate Model Output Rewriter) is used to produce CF-compliant netCDF files
  • dtw: DTW (Dynamic Time Warping) python module
  • shapely: a Python wrapper for GEOS for algebraic manipulation of geometry (manipulation and analysis of geometric objects in the Cartesian plane)
  • cartopy: a library providing cartographic tools for python
  • rpy2: providing simple and robust access to R from within Python
  • cmocean: beautiful colormaps for oceanography
  • OSGeo/GDAL: Geospatial Data Abstraction Library. GDAL is a translator library for raster and vector geospatial data formats
  • spanlib: Spectral Analysis Library
  • windspharm: spherical harmonic wind analysis in Python

Removed packages

  • NO removed packages!

Environments summary

After following the steps above, we get the following environments. Use the conda info --envs or the conda env list command to get the up-to-date list of available environments

Environment
name
Server conda list
cdat-8.0_py2 LSCE
cdatm17_py2 LSCE
cdat-nightly_py2 LSCE
ciclad
cdatm-nightly_py2 LSCE
ciclad





[ PMIP3 Wiki Home ] - [ Help! ] - [ Wiki syntax ]

other/uvcdat/cdat_conda/cdat_8_0_py2.1552485242.txt.gz · Last modified: 2019/03/13 13:54 by jypeter