UNIX - Installation Using Pyenv

1. Pyenv Installation

See the official Pyenv installation guide for more details and the most recent version.

  • Install pyenv to install the necessary Python version (you do not need to do this if you already have the correct Python version installed):

    sudo apt-get install git
    curl https://pyenv.run | bash
    
  • For bash:
    Stock Bash startup files vary widely between distributions in which of them source which, under what circumstances, in what order and what additional configuration they perform. As such, the most reliable way to get Pyenv in all environments is to append Pyenv configuration commands to both .bashrc (for interactive shells) and the profile file that Bash would use (for login shells).

    First, add the commands to ~/.bashrc by running the following in your terminal:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
    echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(pyenv init -)"' >> ~/.bashrc
    
  • Then, if you have ~/.profile, ~/.bash_profile or ~/.bash_login, add the commands there as well. If you have none of these, add them to ~/.profile.

  • To add to ~/.profile:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
    echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
    echo 'eval "$(pyenv init -)"' >> ~/.profile
    
  • To add to ~/.bash_profile:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
    echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
    echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
    
  • For Zsh and Fish shell see official guide

  • Restart your shell for the PATH changes to take effect:

    exec "$SHELL"
    
  • Install Python build dependencies before attempting to install a new Python version.

  • You can now begin using Pyenv.

2. Python Installation

  • Type in to the terminal

    pyenv install <python_version>
    

    for example pyenv install 3.11.3.
    <python_version> is the python version you want to install (3.11.3 or higher is suggested for NOMAD-CAMELS).

3. Install CAMELS

  • Create a folder where you want to install CAMELS (e.g. \NOMAD-CAMELS\)

  • Type in your shell

    cd \NOMAD-CAMELS\;pyenv local <python_version> 
    
  • If you have a working Python environment (python -V in /NOMAD-CAMELS/ returns <python_version>) then you can continue to install CAMELS.

  • Now run the command

    python -m venv .desertenv
    

    in this folder to create a virtual Python environment (using the Python version given by pyenv local <python_version>)

  • Now activate the environment with

    source ./.desertenv/bin/activate
    
  • Now type

pip install nomad-camels 

to install CAMELS.

4. Run CAMELS

You can then run

nomad-camels

or

python -m nomad_camels

to start CAMELS.

If this does not work for you you can go to /.desertenv/Lib/site-packages/nomad_camels/ and run CAMELS using

python .\CAMELS_start.py

or run:

python ./desertenv/lib/python<version>/site-packages/nomad_camels/CAMELS_start.py

5. Troubleshooting

Sometimes packages that are needed to run the qt libraries used for the GUI need to be installed addiitonally. The following should install all necessary packages:

sudo apt-get install build-essential libssl-dev libffi-dev libegl1 libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0 x11-utils libxcb-cursor0 libopengl0 libegl1-mesa libgl1-mesa-glx libpulse0