NOAA-GFDL/MDTF-diagnostics

Unable to install MDTF from the current main branch

Closed this issue · 5 comments

Bug Severity
2 = Major problem that affects overall functionality, but that does not occur for all users (e.g., problems installing the framework with a specific Conda version, a framework option that causes one or more PODs to fail, or missing/incompatible Python modules).

Describe the bug
I started developing my POD few months ago. I was able to do the installation before. However, since I merged the latest commits on main branch, when I do installation, I encounter an error related to mamba installation.

Steps To Reproduce

The setup failed both on Linux and Mac (which previous version worked before). I executed:

$ ./src/conda/conda_env_setup.sh --all --conda_root /home/[username]/miniconda3 --env_dir /home/[username]/miniconda3/envs

and then I encountered the error No module named 'conda.cliconda' from mamba installation. See "Log information and/or terminal output" for the error output from linux. The error from Mac is also the same (No module named 'conda.cliconda').

Environment
I have MDTF installed on both (1) my local Mac machine and (2) remote linux machine.

(1) Mac environment

  • OS: iMac 3 GHz 6-Core Intel Core i5
  • Conda version:
     active environment : base
    active env location : /Users/[username]/miniconda3
            shell level : 1
       user config file : /Users/[username]/.condarc
 populated config files : 
          conda version : 23.5.2
    conda-build version : not installed
         python version : 3.11.4.final.0
       virtual packages : __archspec=1=x86_64
                          __osx=10.16=0
                          __unix=0=0
       base environment : /Users/[username]/miniconda3  (writable)
      conda av data dir : /Users/[username]/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/[username]/miniconda3/pkgs
                          /Users/[username]/.conda/pkgs
       envs directories : /Users/[username]/miniconda3/envs
                          /Users/[username]/.conda/envs
               platform : osx-64
             user-agent : conda/23.5.2 requests/2.29.0 CPython/3.11.4 Darwin/22.6.0 OSX/10.16
                UID:GID : 501:20
             netrc file : None
           offline mode : False
  • branch name: main

(2) Linux environment

  • OS: Ubuntu 18.04
  • Conda version:
     active environment : base
    active env location : /home/[username]/miniconda3
            shell level : 1
       user config file : /home/[username]/.condarc
 populated config files : 
          conda version : 4.10.3
    conda-build version : not installed
         python version : 3.7.6.final.0
       virtual packages : __cuda=12.0=0
                          __linux=4.15.0=0
                          __glibc=2.27=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/[username]/miniconda3  (writable)
      conda av data dir : /home/[username]/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/[username]/miniconda3/pkgs
                          /home/[username]/.conda/pkgs
       envs directories : /home/[username]/miniconda3/envs
                          /home/[username]/.conda/envs
               platform : linux-64
             user-agent : conda/4.10.3 requests/2.28.1 CPython/3.7.6 Linux/4.15.0-214-generic ubuntu/18.04.6 glibc/2.27
                UID:GID : 1001:1001
             netrc file : None
           offline mode : False
  • branch name: main

Log information and/or terminal output

$ ./src/conda/conda_env_setup.sh --all --conda_root /home/[username]/miniconda3 --env_dir /home/[username]/miniconda3/envs

WARNING: user supplied CONDA_ROOT so unsetting existing CONDA_EXE
CONDA_ROOT set from command line
Looking for conda executable in /home/[username]/miniconda3
Found CONDA_EXE
_CONDA_EXE=/home/[username]/miniconda3/bin/conda
_CONDA_ROOT=/home/[username]/miniconda3
Installing envs into /home/[username]/miniconda3/envs
To use envs interactively, run "conda config --append envs_dirs /home/[username]/miniconda3/envs"
Couldn't find mamba executable; installing in temp environment.
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/[username]/miniconda3/envs/_MDTF_install_temp



Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: /home/[username]/miniconda3/envs/_MDTF_install_temp

  added / updated specs:
    - mamba


The following NEW packages will be INSTALLED:

  _libgcc_mutex      conda-forge/linux-64::_libgcc_mutex-0.1-conda_forge
  _openmp_mutex      conda-forge/linux-64::_openmp_mutex-4.5-2_gnu
  archspec           conda-forge/noarch::archspec-0.2.2-pyhd8ed1ab_0
  boltons            conda-forge/noarch::boltons-23.0.0-pyhd8ed1ab_0
  brotli-python      conda-forge/linux-64::brotli-python-1.1.0-py312h30efb56_1
  bzip2              conda-forge/linux-64::bzip2-1.0.8-hd590300_5
  c-ares             conda-forge/linux-64::c-ares-1.23.0-hd590300_0
  ca-certificates    conda-forge/linux-64::ca-certificates-2023.11.17-hbcca054_0
  certifi            conda-forge/noarch::certifi-2023.11.17-pyhd8ed1ab_0
  cffi               conda-forge/linux-64::cffi-1.16.0-py312hf06ca03_0
  charset-normalizer conda-forge/noarch::charset-normalizer-3.3.2-pyhd8ed1ab_0
  colorama           conda-forge/noarch::colorama-0.4.6-pyhd8ed1ab_0
  conda              conda-forge/linux-64::conda-23.11.0-py312h7900ff3_1
  conda-libmamba-so~ conda-forge/noarch::conda-libmamba-solver-23.11.1-pyhd8ed1ab_0
  conda-package-han~ conda-forge/noarch::conda-package-handling-2.2.0-pyh38be061_0
  conda-package-str~ conda-forge/noarch::conda-package-streaming-0.9.0-pyhd8ed1ab_0
  distro             conda-forge/noarch::distro-1.8.0-pyhd8ed1ab_0
  fmt                conda-forge/linux-64::fmt-10.1.1-h00ab1b0_1
  icu                conda-forge/linux-64::icu-73.2-h59595ed_0
  idna               conda-forge/noarch::idna-3.6-pyhd8ed1ab_0
  jsonpatch          conda-forge/noarch::jsonpatch-1.33-pyhd8ed1ab_0
  jsonpointer        conda-forge/linux-64::jsonpointer-2.4-py312h7900ff3_3
  keyutils           conda-forge/linux-64::keyutils-1.6.1-h166bdaf_0
  krb5               conda-forge/linux-64::krb5-1.21.2-h659d440_0
  ld_impl_linux-64   conda-forge/linux-64::ld_impl_linux-64-2.40-h41732ed_0
  libarchive         conda-forge/linux-64::libarchive-3.7.2-h039dbb9_0
  libcurl            conda-forge/linux-64::libcurl-8.4.0-hca28451_0
  libedit            conda-forge/linux-64::libedit-3.1.20191231-he28a2e2_2
  libev              conda-forge/linux-64::libev-4.33-h516909a_1
  libexpat           conda-forge/linux-64::libexpat-2.5.0-hcb278e6_1
  libffi             conda-forge/linux-64::libffi-3.4.2-h7f98852_5
  libgcc-ng          conda-forge/linux-64::libgcc-ng-13.2.0-h807b86a_3
  libgomp            conda-forge/linux-64::libgomp-13.2.0-h807b86a_3
  libiconv           conda-forge/linux-64::libiconv-1.17-h166bdaf_0
  libmamba           conda-forge/linux-64::libmamba-1.5.4-had39da4_0
  libmambapy         conda-forge/linux-64::libmambapy-1.5.4-py312hd9e9ff6_0
  libnghttp2         conda-forge/linux-64::libnghttp2-1.58.0-h47da74e_0
  libnsl             conda-forge/linux-64::libnsl-2.0.1-hd590300_0
  libsolv            conda-forge/linux-64::libsolv-0.7.27-hfc55251_0
  libsqlite          conda-forge/linux-64::libsqlite-3.44.2-h2797004_0
  libssh2            conda-forge/linux-64::libssh2-1.11.0-h0841786_0
  libstdcxx-ng       conda-forge/linux-64::libstdcxx-ng-13.2.0-h7e041cc_3
  libuuid            conda-forge/linux-64::libuuid-2.38.1-h0b41bf4_0
  libxml2            conda-forge/linux-64::libxml2-2.11.6-h232c23b_0
  libzlib            conda-forge/linux-64::libzlib-1.2.13-hd590300_5
  lz4-c              conda-forge/linux-64::lz4-c-1.9.4-hcb278e6_0
  lzo                conda-forge/linux-64::lzo-2.10-h516909a_1000
  mamba              conda-forge/linux-64::mamba-1.5.4-py312h9460a1c_0
  menuinst           conda-forge/linux-64::menuinst-2.0.0-py312h7900ff3_1
  ncurses            conda-forge/linux-64::ncurses-6.4-h59595ed_2
  openssl            conda-forge/linux-64::openssl-3.2.0-hd590300_1
  packaging          conda-forge/noarch::packaging-23.2-pyhd8ed1ab_0
  pip                conda-forge/noarch::pip-23.3.1-pyhd8ed1ab_0
  platformdirs       conda-forge/noarch::platformdirs-4.1.0-pyhd8ed1ab_0
  pluggy             conda-forge/noarch::pluggy-1.3.0-pyhd8ed1ab_0
  pybind11-abi       conda-forge/noarch::pybind11-abi-4-hd8ed1ab_3
  pycosat            conda-forge/linux-64::pycosat-0.6.6-py312h98912ed_0
  pycparser          conda-forge/noarch::pycparser-2.21-pyhd8ed1ab_0
  pysocks            conda-forge/noarch::pysocks-1.7.1-pyha2e5f31_6
  python             conda-forge/linux-64::python-3.12.0-hab00c5b_0_cpython
  python_abi         conda-forge/linux-64::python_abi-3.12-4_cp312
  readline           conda-forge/linux-64::readline-8.2-h8228510_1
  reproc             conda-forge/linux-64::reproc-14.2.4.post0-hd590300_1
  reproc-cpp         conda-forge/linux-64::reproc-cpp-14.2.4.post0-h59595ed_1
  requests           conda-forge/noarch::requests-2.31.0-pyhd8ed1ab_0
  ruamel.yaml        conda-forge/linux-64::ruamel.yaml-0.18.5-py312h98912ed_0
  ruamel.yaml.clib   conda-forge/linux-64::ruamel.yaml.clib-0.2.7-py312h98912ed_2
  setuptools         conda-forge/noarch::setuptools-68.2.2-pyhd8ed1ab_0
  tk                 conda-forge/linux-64::tk-8.6.13-noxft_h4845f30_101
  tqdm               conda-forge/noarch::tqdm-4.66.1-pyhd8ed1ab_0
  truststore         conda-forge/noarch::truststore-0.8.0-pyhd8ed1ab_0
  tzdata             conda-forge/noarch::tzdata-2023c-h71feb2d_0
  urllib3            conda-forge/noarch::urllib3-2.1.0-pyhd8ed1ab_0
  wheel              conda-forge/noarch::wheel-0.42.0-pyhd8ed1ab_0
  xz                 conda-forge/linux-64::xz-5.2.6-h166bdaf_0
  yaml-cpp           conda-forge/linux-64::yaml-cpp-0.8.0-h59595ed_0
  zstandard          conda-forge/linux-64::zstandard-0.22.0-py312hd58854c_0
  zstd               conda-forge/linux-64::zstd-1.5.5-hfc55251_0


Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
No module named 'conda.cliconda'

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/home/[username]/miniconda3/envs/_MDTF_install_temp/lib/python3.12/site-packages/conda/exception_handler.py", line 17, in __call__
        return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
      File "/home/[username]/miniconda3/envs/_MDTF_install_temp/lib/python3.12/site-packages/mamba/mamba.py", line 956, in exception_converter
        raise e
      File "/home/[username]/miniconda3/envs/_MDTF_install_temp/lib/python3.12/site-packages/mamba/mamba.py", line 949, in exception_converter
        exit_code = _wrapped_main(*args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/[username]/miniconda3/envs/_MDTF_install_temp/lib/python3.12/site-packages/mamba/mamba.py", line 895, in _wrapped_main
        result = do_call(parsed_args, p)
                 ^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/[username]/miniconda3/envs/_MDTF_install_temp/lib/python3.12/site-packages/mamba/mamba.py", line 758, in do_call
        exit_code = clean(args, parser)
                    ^^^^^^^^^^^^^^^^^^^
      File "/home/[username]/miniconda3/envs/_MDTF_install_temp/lib/python3.12/site-packages/mamba/mamba.py", line 701, in clean
        module = import_module("conda.cli" + relative_mod, __name__.rsplit(".", 1)[0])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/[username]/miniconda3/envs/_MDTF_install_temp/lib/python3.12/importlib/__init__.py", line 90, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1318, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'conda.cliconda'

`$ /home/[username]/miniconda3/envs/_MDTF_install_temp/bin/mamba clean -qi`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=_MDTF_install_temp
                CONDA_EXE=/home/[username]/miniconda3/bin/conda
             CONDA_PREFIX=/home/[username]/miniconda3/envs/_MDTF_install_temp
           CONDA_PREFIX_1=/home/[username]/miniconda3
    CONDA_PROMPT_MODIFIER=(_MDTF_install_temp)
         CONDA_PYTHON_EXE=/home/[username]/miniconda3/bin/python
               CONDA_ROOT=/home/[username]/miniconda3/envs/_MDTF_install_temp
              CONDA_SHLVL=2
           CURL_CA_BUNDLE=<not set>
               LD_PRELOAD=<not set>
                     PATH=/home/[username]/miniconda3/envs/_MDTF_install_temp/bin:/home/[username]/minicon
                          da3/condabin:/home/[username]/.local/bin:/home/[username]/miniconda3/bin:/home/c
                          lare/miniconda3/condabin:/home/[username]/spark-2.4.4-bin-hadoop2.7/bin:/us
                          r/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/
                          usr/local/games:/usr/lib/jvm/jdk-
                          11.0.3/bin:/snap/bin:/usr/lib/jvm/java-11-
                          oracle/bin:/usr/lib/jvm/java-11-
                          oracle/db/bin:/home/[username]/bin:/home/[username]/jdk1.8.0_221/bin
               PYTHONPATH=:/home/[username]/Dropbox/GitHub-siying/plurk_posting
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : /home/[username]/miniconda3/envs/_MDTF_install_temp
            shell level : 2
       user config file : /home/[username]/.condarc
 populated config files : 
          conda version : 23.11.0
    conda-build version : not installed
         python version : 3.12.0.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=zen
                          __conda=23.11.0=0
                          __cuda=12.0=0
                          __glibc=2.27=0
                          __linux=4.15.0=0
                          __unix=0=0
       base environment : /home/[username]/miniconda3/envs/_MDTF_install_temp  (writable)
      conda av data dir : /home/[username]/miniconda3/envs/_MDTF_install_temp/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/[username]/miniconda3/envs/_MDTF_install_temp/pkgs
                          /home/[username]/.conda/pkgs
       envs directories : /home/[username]/miniconda3/envs/_MDTF_install_temp/envs
                          /home/[username]/.conda/envs
               platform : linux-64
             user-agent : conda/23.11.0 requests/2.31.0 CPython/3.12.0 Linux/4.15.0-214-generic ubuntu/18.04.6 glibc/2.27 solver/libmamba conda-libmamba-solver/23.11.1 libmambapy/1.5.4
                UID:GID : 1001:1001
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
If you suspect this error is being caused by a malfunctioning plugin,
consider using the --no-plugins option to turn off plugins.

Example: conda --no-plugins install <package>

Alternatively, you can set the CONDA_NO_PLUGINS environment variable on
the command line to run the command without plugins enabled.

Example: CONDA_NO_PLUGINS=true conda install <package>

@yihungkuo Thank you for the discussion this evening! Here's the ticket I created for the installation issue.

@csyhuang After looking at some stack overflow posts, it looks like there is an issue with the PYTHONPATH environment variable or there is a collision between the Python version update and the version of miniconda3 on your machine(s). You can try resetting PYTHONPATH, or uninstalling miniconda3 and installing latest version of miniconda3 (or uninstall/reinstall the latest version if you are already using it). I'm not sure if you can do the latter on your workstation if you are relying a central installation maintained by your institution, but you can try it on your personal Mac. See this thread for the full details.

@wrongkindofdoctor thanks for the reply. I tried on my Mac completely uninstalling miniconda, reinstall the latest version and then rerun the MDTF setup (as stated above) but still got the same error unfortunately.

The latest miniconda release is in python 3.11:
https://docs.conda.io/projects/miniconda/en/latest/
while the installation of MDTF involves python 3.12 (python conda-forge/linux-64::python-3.12.0-hab00c5b_0_cpython) - I wonder if this is related to the error.

(Given no success on my Mac machine, I am not doing this on the linux machine for now)

FYI, printing out my sys path gives

>> sys.path
['', '/Users/username/miniconda3/lib/python311.zip', '/Users/username/miniconda3/lib/python3.11', '/Users/username/miniconda3/lib/python3.11/lib-dynload', '/Users/username/miniconda3/lib/python3.11/site-packages']

@csyhuang Are you able to install mamba in your conda base environment:

conda activate base
conda install -c conda-forge mamba

If so, then you can just activate the base environment before running conda_env_setup.sh and the installer will skip installing mamba in the temp environment. If neither of these solve the problem, you can try installing the the environments that you need using the conda command directly:

conda env create --force -q -p=$conda_prefix -f=$env_file

where $conda_prefix = $CONDA_ROOT/envs and $env_file = $MDTF_INSTALL_ROOT_PATH/mdtf/MDTF-diagnostics/src/conda/[env file name].yml

You can then create your own mdtf executable file [MDTF_ROOT_PATH]/mdtf/MDTF-diagnostics/mdtf
with the following linew, substituting the appropriate paths for MDTF_ROOT_PATH and PATH TO MINICONDA3 INSTALLATION:

#!/usr/bin/env bash
# This wrapper script is generated by conda_env_setup.sh.
_mdtf="[MDTF_ROOT_PATH]/mdtf/MDTF-diagnostics"
source "${_mdtf}/src/conda/conda_init.sh" -q "[PATH TO MINICONDA3 INSTALLATION]/miniconda3"
conda activate [PATH TO MINICONDA3 INSTALLATION]/miniconda3/envs/_MDTF_base
"${_mdtf}/mdtf_framework.py" "$@"
exit $?

This will take longer, but will likely be more manageable on your Mac since it is not using a shared file system.

You can also try installing micromamba, and using the corresponding build scripts and runtime configurations indicated in the documentation. Make sure to set the "micromamba_exe" path in your runtime config file if you build with micromamba.

As a last resort, you may have to check out the tag or commit of the last version that worked for you and use that instead of the latest version.

Also, I noticed that the installation paths include "/home/username" in the prefix. I don't know if this necessarily affects the installation, but "username" is meant to be substituted with your user name on the systems you are trying to build on (e.g., /home/csyhuang/...).

@wrongkindofdoctor Hi Jess, thank you for the instructions! Sorry for not getting back earlier as I was traveling and not able to access my linux machine. After pulling the latest commits today, I was able to run the conda installation properly without changing any of my machine settings. The issue has been fixed so this ticket can be closed.