News:

alphaMELTS 1.9 is available at the download and information site.
alphaMELTS 2 standalone & for MATLAB/Python are available on request
(see the Version 2 tab on the download site for more details).
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 2018)

Started by Paula, September 19, 2018, 03:34:13 PM

Previous topic - Next topic

Paula

Note: this post was written when Ubuntu 18.04 LTS was the latest version available in the Microsoft store. If you have downloaded rhyolite-MELTS from the OFM website you will run into this problem when using it with Ubuntu 18.04 LTS. We recommend you download rhyolite-MELTS from the alphaMELTS links page and use the instructions on the newest version of this post.

For 64-bit Windows 10 with the Fall Creators update (version 1709; released October 17th, 2017), it is possible to enable the 'Windows Subsystem for Linux' (WSL) and use the latest rhyolite-MELTS version linked on the alphaMELTS links page. 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 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 18.04 LTS' are currently the same (at the time of writing; Ubuntu 18.04 has now been superseded by Ubuntu 20.04), though are offered as separate installations (click 'More' under the software description for a fuller explanation). 'Ubuntu 16.04 LTS' is older and was simply called 'ubuntu' when the WSL became available in 2017. For most purposes Ubuntu / Ubuntu 18.04 LTS should be fine, but you can always install both 16.04 and 18.04 side-by-side if you need them and have space - them both of together will still be much smaller than the VirtualBox VM alphaMELTS alternative.

Enable the WSL and install ubuntu
  • 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 Windows Store and search for 'ubuntu'. Choose 'Ubuntu', or another version, 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.
  • We recommend you select 'Pin to Start' and/or 'Pin to taskbar' for the ubuntu executable. If you want to do 'Pin to Start' at a later date, just open the Windows Store and search for 'ubuntu' again.
Set up the ubuntu command line
  • Open ubuntu, if it is not already open. Right-click on the ubuntu icon in the upper left-hand corner and choose Properties. Make sure that 'QuickEdit Mode' is checked. Now you can select text, including commands in these instructions (using control-c) and then paste them to the command line by right-clicking the mouse or trackpad in the ubuntu window.
  • Note that you can use ubuntu commands and Linux software to modify your regular files on Windows. Generally, you should 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'.
  • Finally before we continue to the next step, we want to move a settings file that may be overwritten, if it exists. The original Ubuntu WSL didn't have this file, but the Ubuntu 18.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
    ... if the file doesn't exist then the 'mv' command will give an error that you can safely ignore
Install alphaMELTS (optional)

If you want to install alphaMELTS, then if you do that now it will do the next steps for you. Download the alphamelts_wsl_version.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 alphamelts_wsl_version.zip is using 'cd' (which stands for 'change directory'). E.g:
Quotecd Downloads
cd alphamelts_

... 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 folder where the .command scripts are
./install.command
Choose the default settings offered by install.command (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. If you have a profile_backup file from earlier then do the following:
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 ubuntu (type 'exit' or use the X in the top right hand corner) and open it again.

If you did not install alphaMELTS

This step makes 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/alphaMELTS.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:
Quotecat profile_backup profile > .profile
... use the 'cat' command if you have a profile_backup file from earlier; if not you can use 'mv' instead i.e.
mv 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 and some helper software
  • Download the 64-bit Ubuntu 16.04 LTS rhyolite-MELTS/pMELTS executable or the 64-bit Ubuntu 18.04 LTS rhyolite-MELTS/pMELTS executable, whichever matches your ubuntu installation, from the alphaMELTS links page. 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.)
  • We need to install two libraries that are not included in the default ubuntu installation, as Microsoft intended the WSL to be command line only. Open ubuntu, if it is not already open:
    Quotesudo apt install libxft2 libxmu6
    ... enter your Linux password when prompted and choose 'y' to install the necessary packages
    'apt' is the ubuntu package manager; you will also use it for updating ubuntu when needed. 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 have tested Xming and X410, both of which are paid apps. There are free alternatives but we have not tried them out (and do not intend to). Xming requires a small donation and also admin access to allow apps to be installed from outside the Microsoft Store (although if your machine is set up to use campus-licensed software this may already have been done). X410 is installed via the Microsoft Store, so does not need administrator access, and works out of the box (with built-in support for high-resolution screens); at full price it is more expensive than Xming, though it is currently on sale. Xming set up and configuration is slightly more involved than X410, but still not complicated.

New: as version of 2.0, x410 has an option to fix the scaling so there is no need to install additional software (though it is a bit finicky). Scroll down to the 'Built-in DPI Scaling: section out 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.
  • Note that if you have a high-resolution screen then you will likely have to do some extra configuration to get the rhyolite-MELTS display to render at a usable scale on Xming. The procedure for fixing rhyolite-MELTS display is tiny on high-resolution screen requires administrator access etc., which may influence your choice of which X server to install. If you have a HiDPI screen, we recommend choosing X410 for simplicity.
  • The Xming donation (approx. $15 US) is made via PayPal, but you do not need to have a PayPal account. You will receive a Donor Password via email, though bear in mind that the developer is located in the UK so there may be a few hours delay, due to the time difference. Once you have a Donor Password, go to Releases. Download and run the Xming-64 installer. Next download and install the Xming-fonts installer; make sure to install to the same location (should be 'C:\Program Files\Xming' by default).
  • 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 Windows Store and search for 'X410'.
Start Xming or 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 then follow the guidelines in this post for Xming or this post for X410. You will not need to repeat all these steps next time. Just open the ubuntu program, navigate to the folder where your input (.melts) files are, and type 'Melts-rhyolite'.

Any problems, please let me know,
Paula