MELTS Software Users

MELTS for Excel, rhyolite-MELTS (GUI) and alphaMELTS => Operating system specific => Windows => Topic started by: Paula on July 04, 2020, 11:34:43 AM

Title: Updated: enabling the WSL and installing the Rhyolite-MELTS GUI (new for 2020)
Post by: Paula on July 04, 2020, 11:34:43 AM
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 (https://github.com/magmasource/alphaMELTS) 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 (https://magmasource.caltech.edu/forum/index.php/topic,1057.0.html).
 [/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 (https://magmasource.caltech.edu/gitlist/Rhyolite-MELTS.git/blob/master/rhyolite-MELTS-Ubuntu-18.04-64bit.zip"). (If you have downloaded rhyolite-MELTS from the OFM website you will run into this problem (https://magmasource.caltech.edu/forum/index.php/topic,826.0.html) 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 (https://magmasource.caltech.edu/forum/index.php/topic,841.0.html).

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 (https://docs.microsoft.com/en-us/windows/wsl/install-win10). 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 (https://docs.microsoft.com/en-us/windows/wsl/compare-versions). 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 (//http://) 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 (#post_post_xserver) section) but you will need to edit the '.profile' settings file.

Enable the WSL, install ubuntu and some helper software

Set up the ubuntu command line

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 (https://magmasource.caltech.edu/gitlist/alphaMELTS2.git/zipball/master) 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

Choose and install an X server

You will need to install an X server. We recommend X410 (https://token2shell.com/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 (https://magmasource.caltech.edu/forum/index.php/topic,841.0.html#post_xserver)). 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 (https://token2shell.com/howto/x410/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 (https://token2shell.com/howto/x410/) entries on the Choung Networks site for more details, including how to use X410 with WSL 2 (https://x410.dev/cookbook/wsl/using-x410-with-wsl2/).

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
Title: Re: Updated: enabling the WSL and installing the Rhyolite-MELTS GUI (new for 2020)
Post by: Mitsuki OGASAWARA on September 04, 2024, 10:54:00 AM
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?
Title: Re: Updated: enabling the WSL and installing the Rhyolite-MELTS GUI (new for 2020)
Post by: Paula on September 09, 2024, 03:50:59 PM
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 (https://magmasource.caltech.edu/alphamelts/links.php)). Although our main development effort is with alphaMELTS we hope to continue providing occasional updates for easyMelts too.

Paula