If you have questions about Python, read:
If you mostly want to use the python distribution based on CDAT 8.2.1 installed by JYP, just use the following steps and then read the What should I do now? section below
Server | tcsh | bash |
---|---|---|
LSCE | source ~jypeter/.conda3_21-02_jyp.csh | source ~jypeter/.conda3_21-02_jyp.sh |
ciclad | source ~jypmce/.conda3_jyp.csh n/a | source ~jypmce/.conda3_jyp.sh n/a |
conda activate env_name
conda activate cdatm_py3
which python
(or the wp
alias) and make sure you get something looking like[…]/miniconda3<possibly_some_version>/envs/<some_env_name>/bin/python
cdatm_py3
environment at LSCE:/home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm_py3/bin/python
You are ready if you have typed the conda activate
command specified in the previous section!
source
line to your shell configuration file so that you don't have to remember it and type it each time you open a new terminalactivate
command in a terminal only when you want to use this specific version of python, rather than having the activate
in your shell configuration file. This may have some side effects in some casesRead the next sections of this web page
There are some slight differences if you want to install this distribution:
The notes at the beginning of each section will tell you if you can skip the section if you are just installing for you
Note: this particular CDAT installation at LSCE (and on other machines/servers) provides many extra (non-CDAT) packages. You can jump directly to the Extra package list at the bottom of this page, if you want to see what is available
If Miniconda3 is not already installed, or if you want to start over with a brand new version, read JYP steps for installing Miniconda3.
We first check that we have indeed access to a (mini)conda installation (the base environment we get if we have correctly installed miniconda3), and we assume that we have a write-access to the conda disk hierarchy, and a few Gb of disk space available
> conda env list | grep base base * /home/share/unix_files/cdat/miniconda3_21-02 > df -h /home/share/ Filesystem Size Used Avail Use% Mounted on prolix3:/share 917G 245G 626G 29% /home/share > du -sh /home/share/unix_files/cdat/miniconda3_21-02 577M /home/share/unix_files/cdat/miniconda3_21-02
We can also use conda env list
and remove some obsolete versions with conda remove -n obsolete_environment --all
, in order to free up some space
Python 2.x is deprecated in CDAT, starting with CDAT 8.2.1.
If you still need to use python 2.7, please use CDAT 8.1
It's possible that, when using the tcsh shell and trying to use the conda create -n cdat-8.2.1_py3 lots_of_parameters_with_wildcards
line, you will get the following error message:
conda: No match
Apparently the tcsh version of conda does not like wildcards too much (CSH install/search fail with '*' variable in an argument)…
In that case, just type bash
and run the installation command in a bash shell
The installation line below is based on information from the CDAT wiki page. See also Some questions and notes about 8.2.1 installation
bash-4.2$ conda config --env --add channels conda-forge bash-4.2$ conda config --set channel_priority strict bash-4.2$ cat .condarc channels: - conda-forge - defaults $ conda config --describe channel_priority $ conda create -n cdat-8.2.1_nompi_py3 -c conda-forge -c cdat/label/v8.2.1 cdat "libnetcdf=*=nompi_*" "mesalib=18.3.1" "python=3"
$ conda create -n cdat-8.2.1_py3 -c conda-forge -c cdat/label/v8.2.1 cdat "libnetcdf=*=mpi_openmpi_*" "mesalib=18.3.1" "python=3"
Resulting list of installed packages
conda list -n cdat-8.2.1_nompi_py3 > cdat_8.2.1_nompi_21-03-05.txt
You can skip this section if you are installing CDAT just for one user (yourself) on a Linux machine (or a Windows 10 machine with WSL)
You will directly make changes and install packages in your main python environment
This section is about the creation of the cdatm19 environment
Notes about actually using the cdatm19 conda-based python
Notes:
$ conda create -n cdatm19_py3 --clone cdat-8.2.1_py3 $ cd /home/share/unix_files/cdat/miniconda3_21-02/envs $ du -sh cdat-8.2.1_py3 cdatm19_py3 2.5G cdat-8.2.1_py3 538M cdatm19_py3
You can skip this section if you are installing CDAT just for one user (yourself) on a Linux machine (or a Windows 10 machine with WSL)
You will directly make changes and install packages in your main python environment
This step could probably be listed at the end, especially in a multi-user environment!
If there is already a cdatm_py3
link (pointing to an older environment), make sure that the new CDAT environment is stable and working correctly before updating the cdatm_py3
link
We create a cdatm_py3 symbolic link in the envs
directory, that has a stable name but can be moved to point to the latest default (and hopefully stable) CDAT environment. In that case, most users can just activate this cdatm_py3 environment and always get the latest stable version.
$ cd /home/share/unix_files/cdat/miniconda3_21-02/envs $ ln -s cdatm19_py3 cdatm_py3 conda env list # conda environments: # base * /home/share/unix_files/cdat/miniconda3_21-02 cdat-8.2.1_py3 /home/share/unix_files/cdat/miniconda3_21-02/envs/cdat-8.2.1_py3 cdatm19_py3 /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm19_py3 cdatm_py3 /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm_py3 $ ls -l /home/share/unix_files/cdat/miniconda3_21-02/envs/ drwxr-xr-x [...] cdat-8.2.1_py3/ drwxr-xr-x [...] cdatm19_py3/ lrwxrwxrwx [...] cdatm_py3 -> cdatm19_py3/
You can use the quick test shown in To Test Your CDAT Installation, and check if you get the expected png file
You can also check the Testing vcs section of the LSCE installation of CDAT 8.1
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…). The downloaded data files will be available in: vcs.sample_data
$ conda activate cdatm19_py3 (cdatm19_py3) $ 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_21-02/envs/cdatm19_py3/share/cdat/sample_data (cdatm19_py3) $ du -sh /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm19_py3/share/cdat/sample_data 174M /home/share/unix_files/cdat/miniconda3_21-02/envs/cdatm19_py3/share/cdat/sample_data $ python >>> import os, vcs >>> vcs.sample_data '/home/jypeter/miniconda3_21-02/envs/cdat-8.2.1_py3/share/cdat/sample_data' >>> os.listdir(vcs.sample_data) ['BlueMarble.ppm', 'clt.nc', 'geo.1deg.ctl', 'geo.1deg.gmp', 'geo.1deg.grb', ...]
After cloning, we are ready to install some extra (e.g. not directly related to CDAT) packages that may be useful to LSCE users
conda install
, mamba install
or pip install
/usr/bin/time mamba install -n cdatm19_nompi_py3 --dry-run -c conda-forge basemap basemap-data basemap-data-hires cartopy cmocean cmor ferret_datasets gdal gdal geopandas glances gsw iris joblib netcdf4 palettable pandas pillow pyferret rpy2 scikit-image scikit-learn seaborn seawater shapely spyder statsmodels windspharm wrf-python xarray xlsxwriter [... lots of information about what would be done followed by some information about how long it took ...] Summary: Install: 167 packages Downgrade: 3 packages Total download: 474 MB DryRunExit: Dry run. Exiting. 8.31user 0.51system 0:11.45elapsed 77%CPU
/usr/bin/time mamba install -n cdatm19_nompi_py3 -c conda-forge basemap basemap-data basemap-data-hires cartopy cmocean cmor ferret_datasets gdal gdal geopandas glances gsw iris joblib netcdf4 palettable pandas pillow pyferret rpy2 scikit-image scikit-learn seaborn seawater shapely spyder statsmodels windspharm wrf-python xarray xlsxwriter
Resulting list of installed packages
conda list -n cdatm19_nompi_py3 > cdatm19_nompi_py3_21-03-06.txt
conda activate cdatm19_py3
pip install dreqPy
pip install --upgrade dreqPy
$ drq -v dreqPy version 01.00.29 [Version 01.00.29]
ipython_ferretmagic
: more details in the Extra packages list sectionconda install -n cdatm19_py3 -c conda-forge cmor
conda install -n cdatm19_py3 -c conda-forge cartopy
conda install -n cdatm19_py3 -c conda-forge joblib
Add here packages that would be useful and have not been installed yet, or have some problems that prevent their installation
conda install -n cdatm15 -c conda-forge wrf-python
top
)conda install -n cdatm15 -c conda-forge glances
Some packages change more often than others, and can be easily updated the following way:
pip install --upgrade dreqPy
drq -v
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!
: need to clean the list below, and move the packages to the ordered list further down
dreqPy
The extra packages below are (more or less) listed in package name alphabetical order. These are the extra packages that we explicitly installed, but there are many more packages installed (e.g. cdatm19_nompi_py3_21-03-06.txt)!
Initialize the environment and type conda list
if you need an up-to-date list, including the packages' version and where they came from (conda-forge for most packages
iris
python-cdo
will install the cdo
package (providing the cdo
executable) as a dependencynco
eccodes
and pygrib
xarray
DataArray.cf
or Dataset.cf
) that allows you to interpret Climate and Forecast metadata convention attributes present on xarray
objectsxarray
[color]
[color]
plotly
conda install dtale -c conda-forge
cfgrib
and pygrib
esmvaltool-python
in order to reduce the size/number of dependencies, after checking that it does not require downgrading important packagesferret_datasets
: Ferret encapsulated in Pythonpip install ferretmagic
GeoPy
makes it easy for Python developers to locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders and other data sources.cartopy
conda install -c conda-forge iris-sample-data
cftime.datetime
dates with any calendar typecdo
[color]
python-kaleido
and dash
requests
and urllib
)eccodes
and cfgrib
conda
(Why I'm not installing Pyleoclim yet)pooch
rasterio
xarray extensiongsw
pip install suntime
flox
, xcdat
, rioxarray
, …xoa
is the successor of vacumm (vacumm does not support Python3)
After following the steps above, we get the following environments. Use the conda env list
command (same result as conda info --envs
) to get the up-to-date list of available environments.
Use conda list -n env_name
to get a detailed list of which packages/modules are installed, or check the conda Installation history section to get more details
Environment name | Server | Summary |
---|---|---|
cdat-8.2.1_py3 | LSCE ciclad | CDAT 8.2.1 & Python 2.7 |
cdat-8.2.1_py3 | LSCE | CDAT 8.2.1 & Python 3.6 |
cdatm19_py3 or cdatm_py3 | LSCE ciclad | CDAT 8.2.1 & P 2.7 JYP version |
cdatm19_py3 or cdatm_py3 | LSCE | CDAT 8.2.1 & P 3.7 JYP version |
[ PMIP3 Wiki Home ] - [ Help! ] - [ Wiki syntax ]