Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade conda environments to Python 3.11 #483

Merged
merged 76 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
9f963fc
update conda environment files to python 3.11 and adjust dependencies…
wrongkindofdoctor Sep 7, 2023
09a3ff1
update python3 version reqs and mdtf versions in docs, driver script,…
wrongkindofdoctor Sep 7, 2023
0497e4b
update python version req to 3.11 in PR template
wrongkindofdoctor Sep 7, 2023
f92677a
add call to ls contents of usr/local
wrongkindofdoctor Sep 7, 2023
2f439d1
more test calls
wrongkindofdoctor Sep 7, 2023
b30c97f
remove echo from ls tests
wrongkindofdoctor Sep 7, 2023
8fbe03d
just ls micromamba dirs
wrongkindofdoctor Sep 7, 2023
295f649
more debugging
wrongkindofdoctor Sep 8, 2023
7bb46a5
update typing module in base env
wrongkindofdoctor Sep 10, 2023
ba8eb3b
remove base typing spec, try another type test
wrongkindofdoctor Sep 10, 2023
28f18ef
fix subclasses init
wrongkindofdoctor Sep 10, 2023
d3d7328
add block to create conda softlink to micromamba bin to test
wrongkindofdoctor Sep 10, 2023
d983543
modify conda dir creation block
wrongkindofdoctor Sep 11, 2023
4af759b
change conda dir to Users/runner
wrongkindofdoctor Sep 11, 2023
97d735d
add check
wrongkindofdoctor Sep 11, 2023
58cf17d
more checks
wrongkindofdoctor Sep 11, 2023
fdf6676
more checks
wrongkindofdoctor Sep 11, 2023
70368bd
more checks
wrongkindofdoctor Sep 11, 2023
d78e798
more checks
wrongkindofdoctor Sep 11, 2023
ee32932
more checks
wrongkindofdoctor Sep 11, 2023
eacbfea
more checks
wrongkindofdoctor Sep 11, 2023
b904821
more checks
wrongkindofdoctor Sep 11, 2023
98774a0
more checks
wrongkindofdoctor Sep 11, 2023
6b2b925
more checks
wrongkindofdoctor Sep 11, 2023
7f0c3be
more checks
wrongkindofdoctor Sep 11, 2023
7304e5f
more checks
wrongkindofdoctor Sep 11, 2023
fe4bd28
more checks
wrongkindofdoctor Sep 11, 2023
990fa57
more checks
wrongkindofdoctor Sep 11, 2023
3680d8a
more checks
wrongkindofdoctor Sep 11, 2023
65bdeeb
more checks
wrongkindofdoctor Sep 11, 2023
d72670f
more checks
wrongkindofdoctor Sep 11, 2023
49eddb7
try adding condabin dir to GITHUB_ENV
wrongkindofdoctor Sep 11, 2023
46e1c9c
remove conda calls from test, modify to start w/set2 tests
wrongkindofdoctor Sep 12, 2023
8510868
more checks
wrongkindofdoctor Sep 12, 2023
fab256c
remove conda alias block and add miniconda action back
wrongkindofdoctor Sep 13, 2023
81b90dc
uncomment set 1 tests
wrongkindofdoctor Sep 14, 2023
ab9e0ae
refactor data_manager pd.merge call to avoid duplicate columns
wrongkindofdoctor Sep 14, 2023
bf0659a
change deprecated np.int and np.float to built-in int and float in se…
wrongkindofdoctor Sep 14, 2023
ca1a927
replace b flag with visible flag and clean up conveTransCriticalColl…
wrongkindofdoctor Sep 15, 2023
350cd08
finalize test jsonc files
wrongkindofdoctor Sep 15, 2023
6a8f3ba
comment out trop_pac_sea_level and temp_extremes_distshape data calls…
wrongkindofdoctor Sep 15, 2023
e6cacab
add macos-12 and ubuntu-latest images back to mdtf_tests
wrongkindofdoctor Sep 15, 2023
d73fbac
fix ci exclude block
wrongkindofdoctor Sep 15, 2023
5acc37d
change max parallel jobs to 3
wrongkindofdoctor Sep 15, 2023
ede92bd
fix ubuntu set3 test file
wrongkindofdoctor Sep 15, 2023
9d93f48
Merge branch 'main' into upgrade_envs
wrongkindofdoctor Sep 20, 2023
15f8c87
Merge branch 'main' into upgrade_envs
wrongkindofdoctor Sep 20, 2023
39bc495
Merge branch 'main' into upgrade_envs
wrongkindofdoctor Sep 20, 2023
7e4ee5d
Merge branch 'main' into upgrade_envs
Oct 13, 2023
3397fb4
add support for micromamba installation to conda_env_setup.sh
wrongkindofdoctor Oct 13, 2023
2ed9798
update conda_init.sh and fix issues in conda_env_setup.sh
wrongkindofdoctor Oct 17, 2023
b06a353
finalize micromamba implementation in conda_env_setup.sh
wrongkindofdoctor Oct 18, 2023
5d8ec12
remove --conda-basic command from install module
wrongkindofdoctor Oct 24, 2023
e74eefd
refine micromamba env variable setup and sourcing in mdtf_tests, cond…
wrongkindofdoctor Oct 25, 2023
a4c98a0
add debugging lines to mdtf_tests
wrongkindofdoctor Oct 25, 2023
7d4317c
add debugging lines to mdtf_tests
wrongkindofdoctor Oct 25, 2023
0f10c4d
fix wkdir path in cat command
wrongkindofdoctor Oct 25, 2023
233a3f7
try changing conda_root to micromamba install location in ubuntu test…
wrongkindofdoctor Oct 25, 2023
86b4432
fix ubuntu tests conda root
wrongkindofdoctor Oct 25, 2023
c503ca7
refine micromamba locations in conda install scripts and add conda en…
wrongkindofdoctor Oct 26, 2023
21cc664
add micromamba paths to actions set1 tests
wrongkindofdoctor Oct 26, 2023
b591a4e
fix call to conda_env_setup in mdtf_tests
wrongkindofdoctor Oct 26, 2023
7bff911
fix call to micromamba-bin paths in mdtf_tests
wrongkindofdoctor Oct 26, 2023
001da0a
add boolean for micromamba executable location in actions to conda_in…
wrongkindofdoctor Oct 26, 2023
c17166b
check that conda_exe info yields a result instead of whether it is an…
wrongkindofdoctor Oct 26, 2023
65fd780
clean up conda install files
wrongkindofdoctor Oct 26, 2023
690c204
switch gh actions tests to use micromamba paths
wrongkindofdoctor Oct 26, 2023
bfcef7a
comment out conda action, swith env file build to use conda install b…
wrongkindofdoctor Oct 26, 2023
e72631a
update cat pod output check
wrongkindofdoctor Oct 26, 2023
38fb88c
fix syntax error
wrongkindofdoctor Oct 26, 2023
b39dc5d
add bash init call to micromamba subprocess command in envrionment_ma…
wrongkindofdoctor Oct 26, 2023
37dd031
fix bash init call
wrongkindofdoctor Oct 26, 2023
0b77632
comment out debugging lines in mdtf_tests
wrongkindofdoctor Oct 27, 2023
de6a329
add micromamba installation instructions to docs and READMe.md, and c…
wrongkindofdoctor Oct 27, 2023
7cb0675
add more updates to dev_start.rst, and include micromamba in default_…
wrongkindofdoctor Oct 27, 2023
205739f
add micromamba to multirun_config_template conda_root description'
wrongkindofdoctor Oct 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ operating system(s) you ran your tests on.

**Checklist:**
- [ ] My branch is up-to-date with the NOAA-GFDL main branch, and all merge conflicts are resolved
- [ ] The scripts are written in Python 3.10 or above (preferred; required if funded by a CPO grant), NCL, or R
- [ ] The scripts are written in Python 3.11 or above (preferred; required if funded by a CPO grant), NCL, or R
- [ ] All of my scripts are in the diagnostics/[POD short name] subdirectory, and include a main_driver script, template html, and settings.jsonc file
- [ ] I have made corresponding changes to the documentation in the POD's doc/ subdirectory
- [ ] I have requested that the framework developers add packages required by my POD to the python3, NCL, or R environment yaml file if necessary, and my environment builds with `conda_env_setup.sh`
Expand Down
67 changes: 43 additions & 24 deletions .github/workflows/mdtf_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-12, macos-13]
json-file: ["tests/github_actions_test_ubuntu_set1.jsonc","tests/github_actions_test_macos_set1.jsonc"]
json-file-set2: ["tests/github_actions_test_ubuntu_set2.jsonc", "tests/github_actions_test_macos_set2.jsonc"]
json-file-set3: ["tests/github_actions_test_ubuntu_set3.jsonc", "tests/github_actions_test_macos_set3.jsonc"]
Expand All @@ -31,45 +31,62 @@ jobs:
json-file-set2: "tests/github_actions_test_macos_set2.jsonc"
- os: ubuntu-latest
json-file-set3: "tests/github_actions_test_macos_set3.jsonc"
- os: macos-latest
- os: macos-12
json-file: "tests/github_actions_test_ubuntu_set1.jsonc"
- os: macos-latest
- os: macos-12
json-file-set2: "tests/github_actions_test_ubuntu_set2.jsonc"
- os: macos-latest
- os: macos-12
json-file-set3: "tests/github_actions_test_ubuntu_set3.jsonc"
max-parallel: 2
- os: macos-13
json-file: "tests/github_actions_test_ubuntu_set1.jsonc"
- os: macos-13
json-file-set2: "tests/github_actions_test_ubuntu_set2.jsonc"
- os: macos-13
json-file-set3: "tests/github_actions_test_ubuntu_set3.jsonc"
max-parallel: 3
steps:
- uses: actions/checkout@v3
#- name: Download Miniconda 3
# uses: conda-incubator/setup-miniconda@v2
# with:
# miniconda-version: "latest"
# python-version: 3.11.0
# channels: conda-forge
#- name: Conda info
# shell: bash -el {0}
# run: conda info
# Set up Micromamba
- uses: mamba-org/setup-micromamba@v1
with:
init-shell: bash
condarc: |
channels:
- conda-forge
- defaults
- name: Initialize and verify miniconda installation
run: |
conda init bash
conda info -a

- name: Install XQuartz if macOS
if: ${{ matrix.os == 'macos-latest'}}
if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13'}}
run: |
echo "Installing XQuartz"
brew install --cask xquartz
echo "CONDA_ROOT=$(echo /Users/runner/micromamba-bin)" >> $GITHUB_ENV
echo "CONDA_ENV_DIR=$(echo /Users/runner/micromamba/envs)" >> $GITHUB_ENV
- name: Set environment variables
run: |
echo "POD_OUTPUT=$(echo $PWD/../wkdir/GFDL.Synthetic)" >> $GITHUB_ENV
echo "POD_OUTPUT=$(echo $PWD/../wkdir)" >> $GITHUB_ENV
- name: Set conda vars
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
echo "CONDA_ROOT=$(echo /home/runner/micromamba-bin)" >> $GITHUB_ENV
echo "CONDA_ENV_DIR=$(echo /home/runner/micromamba/envs)" >> $GITHUB_ENV
- name: Install Conda Environments
run: |
echo "Installing Conda Environments"
echo "conda root ${CONDA_ROOT}"
echo "env dir ${CONDA_ENV_DIR}"
# MDTF-specific setup: install all conda envs
micromamba create -f ./src/conda/env_base.yml
micromamba create -f ./src/conda/env_python3_base.yml
micromamba create -f ./src/conda/env_NCL_base.yml
micromamba create -f ./src/conda/env_R_base.yml
./src/conda/conda_env_setup.sh --all --micromamba_root ${CONDA_ROOT} --env_dir ${CONDA_ENV_DIR}
echo "Creating the _MDTF_synthetic_data environment"
micromamba create -f ./src/conda/_env_synthetic_data.yml
micromamba create -y -f ./src/conda/_env_synthetic_data.yml
- name: Generate Model Data
run: |
cd ../
Expand All @@ -82,6 +99,8 @@ jobs:
mdtf_synthetic.py -c CMIP --startyear 1990 --nyears 20
cd ../
mkdir wkdir
## make input data directories
mkdir -p inputdata/obs_data
- name: Get Observational Data for Set 1
run: |
echo "${PWD}"
Expand All @@ -97,8 +116,6 @@ jobs:
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/MJO_teleconnection_obs_data.tar --output MJO_teleconnection_obs_data.tar
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/MJO_suite_obs_data.tar --output MJO_suite_obs_data.tar
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/precip_diurnal_cycle_obs_data.tar --output precip_diurnal_cycle_obs_data.tar
## make input data directories
mkdir -p inputdata/obs_data
echo "Untarring set 1 NCAR/CESM standard test files"
tar -xvf convective_transition_diag_obs_data.tar
tar -xvf EOF_500hPa_obs_data.tar
Expand All @@ -116,7 +133,9 @@ jobs:
# trivial check that install script worked
./mdtf_framework.py --version
# run the test PODs
./mdtf_framework.py -v -f ${{matrix.json-file}}
./mdtf -v -f ${{matrix.json-file}}
# Debug POD log(s)
# cat ${POD_OUTPUT}/MDTF_NCAR.Synthetic_1975_1981/Wheeler_Kiladis/Wheeler_Kiladis.log
- name: Get observational data for set 2
run: |
echo "${PWD}"
Expand Down Expand Up @@ -157,16 +176,16 @@ jobs:
# attempt FTP data fetch
# allow 20 min for transfer before timeout; Github actions allows 6 hours for individual
# jobs, but we don't want to max out resources that are shared by the NOAA-GFDL repos.
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/temp_extremes_distshape_obs_data.tar --output temp_extremes_distshape_obs_data.tar
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/tropical_pacific_sea_level_obs_data.tar.gz --output tropical_pacific_sea_level_obs_data.tar.gz
#curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/temp_extremes_distshape_obs_data.tar --output temp_extremes_distshape_obs_data.tar
#curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/tropical_pacific_sea_level_obs_data.tar.gz --output tropical_pacific_sea_level_obs_data.tar.gz
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/mixed_layer_depth_obs_data.tar --output mixed_layer_depth_obs_data.tar
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/ocn_surf_flux_diag_obs_data.tar --output ocn_surf_flux_diag_obs_data.tar
# curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/albedofb_obs_data.tar --output albedofb_obs_data.tar
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/seaice_suite_obs_data.tar --output seaice_suite_obs_data.tar
curl --verbose --ipv4 --connect-timeout 8 --max-time 1200 --retry 128 --ftp-ssl --ftp-pasv -u "anonymous:anonymous" ftp://ftp.gfdl.noaa.gov/perm/oar.gfdl.mdtf/stc_eddy_heat_fluxes_obs_data.tar --output stc_eddy_heat_fluxes_obs_data.tar
echo "Untarring set 3 CMIP standard test files"
tar -xvf temp_extremes_distshape_obs_data.tar
tar -zxvf tropical_pacific_sea_level_obs_data.tar.gz
#tar -xvf temp_extremes_distshape_obs_data.tar
#tar -zxvf tropical_pacific_sea_level_obs_data.tar.gz
tar -xvf mixed_layer_depth_obs_data.tar
tar -xvf ocn_surf_flux_diag_obs_data.tar
# tar -xvf albedofb_obs_data.tar
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.11"
# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
Expand Down
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,15 @@ and a link to the full documentation for each currently-supported POD.
#### Visit the [GFDL Youtube Channel](https://www.youtube.com/channel/UCCVFLbjYix7RCz1GgKG2QxA) for tutorials on package installation and other MDTF-diagnostics-related topics

## Prerequisites
- [Anaconda3](https://docs.anaconda.com/anaconda/install/) or [Miniconda3](https://docs.conda.io/en/latest/miniconda.html). Installation instructions are available [here](https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html).
- MDTF-diagnositics is developed for macOS and Linux systems. The package has been tested on, but is not fully supported for, the Windows Subsystem for Linux.
- [Anaconda3](https://docs.anaconda.com/anaconda/install/), [Miniconda3](https://docs.conda.io/en/latest/miniconda.html),
or [micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html).

- Installation instructions are available [here](https://docs.conda.io/projects/conda/en/latest/user-guide/install/linux.html).
- MDTF-diagnositics is developed for macOS and Linux systems. The package has been tested on, but is not fully supported
for, the Windows Subsystem for Linux.
- **Attention macOS M-series chip users**: the MDTF-diagnostics base and python3 conda environments will only build with micromamba on
machines running Apple M-series chips. The NCL and R environments will NOT build on M-series machines because the conda
packages do not support them at this time.
## Notes
- `$` indicates strings to be substituted, e.g., the string `$CODE_ROOT` should be substituted by the actual path to the MDTF-diagnostics directory.
- Consult the [Getting started](https://mdtf-diagnostics.readthedocs.io/en/main/sphinx/start_toc.html) section to learn how to run the framework on your own data and configure general settings.
Expand All @@ -77,10 +84,20 @@ and a link to the full documentation for each currently-supported POD.
- Check out the latest official release: `git checkout tags/[version name]`
- Run `% conda info --base` to determine the location of your Conda installation. This path will be referred to as `$CONDA_ROOT`.
- `cd $CODE_ROOT`, then run
### ANACONADA/MINICONDA
`% ./src/conda/conda_env_setup.sh --all --conda_root $CONDA_ROOT --env_dir $CONDA_ENV_DIR`
- Substitute the actual paths for `$CODE_ROOT`, `$CONDA_ROOT`, and `$CONDA_ENV_DIR`.

- The `--env_dir` flag allows you to put the program files in a designated location `$CONDA_ENV_DIR` (for space reasons, or if you don’t have write access). You can omit this flag, and the environments will be installed within `$CONDA_ROOT/envs/` by default.
### MICROMAMBA on machines that do NOT have Apple M-series chips
`% ./src/conda/conda_env_setup.sh --all --micromamba_root $MICROMAMBA_ROOT --env_dir $CONDA_ENV_DIR`
### MICROMAMBA on machines with Apple M-series chips
`% ./src/conda/conda_env_setup.sh --e base --micromamba_root $MICROMAMBA_ROOT --env_dir $CONDA_ENV_DIR`

`% ./src/conda/conda_env_setup.sh --e python3_base --micromamba_root $MICROMAMBA_ROOT --env_dir $CONDA_ENV_DIR`

- Substitute the actual paths for `$CODE_ROOT`, `$CONDA_ROOT`, `$MICROMAMBA_ROOT`, and `$CONDA_ENV_DIR`.
-`$MICROMAMBA_ROOT` is location of the micromamba executable on your machine (e.g., /home/${USER}/.local/bin)
- The `--env_dir` flag allows you to put the program files in a designated location `$CONDA_ENV_DIR`
(for space reasons, or if you don’t have write access).
You can omit this flag, and the environments will be installed within `$CONDA_ROOT/envs/` by default.

## 2. Download the sample data

Expand Down
Loading