News:

alphaMELTS 2.3 standalone & for MATLAB/Python is now open source and available on GitHub (https://github.com/magmasource/alphaMELTS).
alphaMELTS 1.9 is available at the legacy download and information site.
For news of all MELTS software see the MELTS Facebook page.

Main Menu

Updated: enabling the WSL and installing the Rhyolite-MELTS GUI (new for 2020)

Started by Paula, July 04, 2020, 11:34:43 AM

Previous topic - Next topic

Paula

Note: this post was written when Ubuntu 20.04 LTS was the latest version and alphaMELTS 2 and alphaMELTS for MATLAB/Python were hosted in separate (private) repositories on GitLab. However, Rhyolite-MELTS will not work in Ubuntu 22.04 LTS or later, so the choices described still apply. All new alphaMELTS versions are hosted together in a single open-source alphaMELTS repository on GitHub and the optional alphaMELTS 2 install has been updated to point to the last (public) alphaMELTS 2 version before that combination/move. There is also a newer version of this post.
 [/i]

For 64-bit Windows 10, it is possible to enable the 'Windows Subsystem for Linux' (WSL) and use the latest rhyolite-MELTS for Linux version. (If you have downloaded rhyolite-MELTS from the OFM website you will run into this problem when using it with Ubuntu.) This version of the post assumes you are installing Ubuntu 20.04 LTS on the WSL 1, but instructions for other options are linked. Things that you should type at the command line are in bold in quote boxes; names you should substitute are in italics and comments are preceded by ellipsis (...). Note that by 'command line', we mean the Ubuntu bash shell that opens when you click the 'Ubuntu' program (or select it from the Windows Terminal) and not the Windows Command Prompt (cmd.exe).

There are now two versions of Ubuntu available for the WSL. If you search for 'ubuntu' in the Microsoft Store you will see three versions: 'Ubuntu' and 'Ubuntu 20.04 LTS' are currently the same (at the time of writing now 'Ubuntu' is the same as 'Ubuntu 22.04 LTS' so you should not use either of them), though are offered as separate installations; click 'More' under the software description for a fuller explanation. 'Ubuntu 18.04 LTS' is older and was previously called 'Ubuntu', when Ubuntu 16.04 LTS was the other alternative. For most purposes Ubuntu 20.04 LTS should be fine, and is easier to configure than previous Ubuntu WSL versions (especially for WSL 2). If you need to use Ubuntu 18.04 LTS for some reason, then follow the older version of this post.

As of the Windows 10 May 2020 Update (version 2004; build 19041 or higher), it is possible to enable the WSL 2. You can get more information on how to do this in Microsoft's Windows Subsystem for Linux Installation Guide for Windows 10. Whereas the original WSL was a compatibility layer that used Windows system tools underneath, WSL 2 uses virtualization. This potentially improves system performance; see the WSL 1 vs WSL 2 comparison. In our experience, rhyolite-MELTS opens quite a bit faster on WSL 2 that on WSL 1 (even though we have the files stored in the Windows filesystem), but enabling WSL 2 prevents VM alphaMELTS from running. Note that it is a bit more involved to get rhyolite-MELTS running in WSL 2 than WSL 1; X410 does most of the hard work for you (see the Choose and install an X server section) but you will need to edit the '.profile' settings file.

Enable the WSL, install ubuntu and some helper software
  • This step should not be necessary anymore but if prompted: Open Settings (click either the Start button in the bottom LH corner or the Notification icon in the bottom RH corner; then click the cog icon). Type 'Windows features' in the search box and then select 'Turn Windows features on or off'. Scroll down and check the box beside 'Windows Subsystem for Linux'; click OK and reboot.
  • Open the Microsoft Store and search for 'ubuntu'. Choose 'Ubuntu', or 'Ubuntu 20.04', and select 'Get'.
  • Select 'Launch'. You will be prompted to enter a username and password for Linux. The username is case sensitive; it may, or may not, be the same as your Windows username but you should avoid spaces or special characters in it. The password should be different to your Windows password; you will need to enter it when installing or updating software at the Linux command line.
  • Optionally, download and install VS Code. This can be convenient for editing settings files (especially for WSL 2), as well as rhyolite-MELTS input files.
  • Next return to the Microsoft Store and install 'Windows Terminal'. From now on you should be able to copy commands in these instructions (using Ctrl+C) and then paste them to the Windows Terminal command line by with Ctrl+Shift+V.

Set up the ubuntu command line
  • Open Windows Terminal, if it is not already open. If you click the 'V' drop-down menu 'Ubuntu' (or 'Ubuntu-20.04') should be one of the options.
  • Sometimes Windows Terminal will map Ctrl+C and Ctrl+V to copy and paste (in addition to Ctrl+Shift+C and Ctrl+Shift+V, respectively). You should probably disable that so that Ctrl+C can be used to break out if a program hangs or gets in a loop. In Windows Terminal, go to Settings in the drop-down menu. If you installed VS Code the settings will open in that, but if not you may be asked to choose a text editor e.g. Notepad to edit the settings. Scroll to the bottom. Comment out ('//') or edit the lines under 'keybindings'. For example, you might replace "ctrl+c" and "ctrl+v" with "alt+c" and "alt+v" respectively:
    Quote... e.g. replace
    { "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" }'
    { "command": "paste", keys: "ctrl+v" },

    ... with
    //{ "command": {"action": "copy", "singleLine": false }, "keys": "ctrl+c" }'
    //{ "command": "paste", keys: "ctrl+v" },

    ... or
    { "command": {"action": "copy", "singleLine": false }, "keys": "alt+c" }'
    { "command": "paste", keys: "alt+v" },

  • Note that you can use ubuntu commands and Linux software to modify your regular files on Windows. For WSL 1, you should generally not use Windows programs to modify the ubuntu files (by which we mean the ubuntu system files and the files in your ubuntu home space). So, it's a good idea to keep all your working files in your usual Windows folders and set up links so that you can access them from the command line:
    Quotecd
    ... this just ensures that you are in your ubuntu home directory
    ln -sf /mnt/c/Users/your_windows_username/Downloads .
    ... the space between 'Downloads' and '.' is required
    ... if you copy and paste the command then use the left arrow and delete to replace 'your_windows_username' with the actual name of the folder that your Windows files are stored in
    ... if the 'your_windows_username' folder has spaces in its name you need to put a '\' before each one e.g:
    ln -sf /mnt/c/Users/your\ windows\ username/Downloads .
    You can now switch to the folder by typing 'cd Downloads'. If you don't want the link to be called 'Downloads' then replace '.' with your choice of link name e.g. 'MyFiles'. 'ln' stands for 'link'; '-s' is for 'symbolic', so if you delete the link you do not delete the original file (much like Windows shortcuts); '-f' is for 'force', which makes no difference at this point but should you change your mind about where you want the 'MyFiles' link to point to, then is required to overwrite the original.
  • Substitute 'Downloads' and repeat the above for any other folders that you would like to be able to access from the command line while running rhyolite-MELTS, such as 'Documents' or 'Desktop'.
  • For WSL 2 there may be a performance benefit to storing working files in ubuntu, but it will be easier to keep regular backups if you transfer the output to a Windows folder. So it is probably still worth setting up links.
  • Finally before we continue to the next step, we want to move a settings file that may be overwritten. The original Ubuntu WSL didn't have this file, but the Ubuntu 20.04 LTS version does.
    Quotecd
    ... this just ensures that you are in your ubuntu home directory
    mv .profile profile_backup
    ... where there is a space before the '.' but not after; a file beginning with with '.' is a hidden file in Linux

Install alphaMELTS 2 (optional)

If you want to install alphaMELTS 2, then if you do that now it will do the next steps for you. Download the alphamelts2_git_master.zip file. You should be able to unzip it on Windows. Put the extracted folder in 'Downloads' (or your choice of folder, as long as you have set up a link to it in ubuntu). Open ubuntu, if it is not already open. Navigate to the folder where the alphamelts2_git_master folder is using 'cd' (which stands for 'change directory'). E.g:
Quotecd Downloads
cd alphamelts2_git_master

... if you press the 'tab' key at this point it should complete the folder name
... depending how you extracted the files, you may to repeat the previous command to descend into the 'package' folder where the .command scripts are
cd package
./install2.command


Choose the default settings offered by install2.command i.e. press 'enter' to each folder suggestion, and then 'y' when it asks whether to continue with the installation. This means it will make a 'bin' folder for you to put links in, set the Path to include the 'bin' folder, and set up the DISPLAY variable that rhyolite-MELTS will need (though if you decide to use the WSL 2 you will need to edit the DISPLAY variable).
Quotemv .profile profile
... where there is a space before the '.' but not after; a file beginning with with '.' is a hidden file in Linux
cat profile_backup profile > .profile
Finally close the ubuntu tab (type 'exit' or use the X in the top right hand corner) and open it again.

If you did not install alphaMELTS 2

This step make a 'bin' folder, which is short for 'binary' and is a folder where we will put a link (shortcut) to rhyolite-MELTS. It will set the Path to include the 'bin' folder,  so that you can run rhyolite-MELTS from anywhere on the system. It also sets up the DISPLAY variable that rhyolite-MELTS will need. Open ubuntu, if it is not already open:
Quotecd
... this just ensures that you are in your ubuntu home directory
mkdir bin
... which means make a directory called 'bin' (where 'directory' is what is called 'folder' on Windows)
wget magmasource.caltech.edu/gitlist/alphaMELTS1.git/raw/master/profile
... this downloads a settings file because going through a Windows-based browser causes problems with line-endings etc.
cat profile
This last command just prints the file we just downloaded, so we can check that it downloaded OK before using it. The output should look like this:
Quote# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
    export PATH
fi

# For the Rhyolite-MELTS graphical user interface on the Windows Subsystem for Linux with Xming
if [[ $(uname -r) =~ Microsoft ]] ; then
   export DISPLAY=:0
fi

# For the Rhyolite-MELTS graphical user interface on Macs, using the 10.8+ or 10.12+ executable:
# If you get "Segmentation fault: 11" (10.8+) or "Illegal instruction: 4" (10.12+)
# then include the following and try the 10.8+ executable.
if [[ $(uname) =~ Darwin ]] ; then
   export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace:$DYLD_LIBRARY_PATH
fi
If it does then type you can continue. If you decide to use the WSL 2 you will need to edit the DISPLAY variable in the .profile file. Otherwise:
Quotecat profile_backup profile > .profile
... where there is a space before the '.' but not after; a file beginning with with '.' is a hidden file in Linux
exit
... this closes ubuntu; when you next open it the settings file will be read and acted upon

Download and set up rhyolite-MELTS
  • Download the 64-bit Ubuntu 18.04 LTS rhyolite-MELTS/pMELTS executable. You should be able to unzip it on Windows. Put the extracted file in 'Downloads' (or your choice of folder, as long as you have set up a link to it in ubuntu). Open ubuntu, if it is not already open:
    Quotecd ~/bin
    ... '~' is shorthand for your home space on ubuntu
    ln -sf ../Downloads/Melts-rhyolite-public Melts-rhyolite
    ... see the 'Set up the ubuntu command line' section for an explanation of the 'ln' command; note that '..' means up one directory level
    Since we added the 'bin' folder to the Path you will be able to open rhyolite-MELTS from any folder by typing 'Melts-rhyolite'. (Without these settings you would need to navigate to the folder containing Melts-rhyolite-public and type './Melts-rhyolite-public', where '.' means the current directory.)
  • If you installed VS Code then type 'code'. The first time it will install VS Code Server, which allows you to open files stored in ubuntu for editing. As noted above, you should only store/edit files on ubuntu if you are using WSL 2.
  • You shouldn't need to install anything else within ubuntu, but you will want to apply updates from time to time. 'apt' is the ubuntu package manager. If you get a message about updates being available then type the following:
    Quotesudo apt update
    ... enter your password
    sudo apt upgrade
    sudo apt full-upgrade

    ... choose 'y' as appropriate

Choose and install an X server

You will need to install an X server. We recommend X410 for simplicity, especially if you have a HiDPI screen, and have tested it on WSL 1 and WSL 2. It is a paid app with a nominal price of ~$50, but is seemingly always on sale so the price is actually closer to $10. To install X410 you will need a Microsoft account. There is a free trial option or you can buy it if you have a payment option set up. Open the Microsoft Store and search for 'X410'. If you are not able to install X410, then Xming is an affordable alternative (~$15) that we have tested on WSL 1, but not WSL 2 (pros and cons of Xming versus X410 are described on the earlier version of this post). There are also free alternatives but we have not tried them out.

Start X410 by double-clicking. Test rhyolite-MELTS by typing 'Melts-rhyolite' at the command line and 'n' to select version 1.0.2. If the display is very small, x410 has an option to fix the scaling. Scroll down to the 'Built-in DPI Scaling: section of Running X410 on HiDPI Screens. For rhyolite-MELTS try the 'Default' setting first, but if this doesn't work (x410 crashes) then try 'High Quality'; for other software you will probably be able to use 'High Quality'. See other Howto entries on the Choung Networks site for more details, including how to use X410 with WSL 2.

You will not need to repeat all these steps next time. Just select 'Ubuntu' from the Windows Terminal program, navigate to the folder where your input (.melts) files are, and type 'Melts-rhyolite'.

Any problems, please let me know,
Paula

Mitsuki OGASAWARA

Hi Paula,

I'm Mitsuki from Japan.
I want to know How can I install and use MELTS for Win11. Is it same way to install for Win10?

Paula

Hi Mitsuki,

I've just posted instructions for using Ubuntu 20.04 with Windows 11 (or Windows 10 with November 2021 update or later). They are a bit simpler than previously but, as Ubuntu 20.04 LTS will only be supported until Spring 2025, I am not sure how long they will work for.

The GUI isn't really supported anymore. The Linux versions haven't been updated since 2018 and the Mac ones are even older. There have been some important bugs fixed in the underlying code but it's getting too difficult to build the interface.

We recommend you try easyMelts instead, which is like a more modern version of the GUI and works on native Windows, Mac and Linux (see the alphaMELTS links page). Although our main development effort is with alphaMELTS we hope to continue providing occasional updates for easyMelts too.

Paula