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

[FAQ] Installing Perl and setting the PATH

Started by Paula, June 24, 2021, 03:44:55 PM

Previous topic - Next topic

Paula

Mac and Linux

Perl should be installed by default on Mac or Linux (including the Windows Subsystem for Linux) and install2.command should be able to set the Path successfully whether you are using bash or zsh shell. You may need to log out and in for it to take effect. If you install something like Anaconda on Mac it can break the alphaMELTS installation. Simply run install2.command again to repair it.

To install Perl on Windows:

On Windows, if you have MATLAB installed then that contains Perl. The first time you install alphaMELTS you need to do right-click install2.command and do "Open with..." and choose the Perl within MATLAB. The perl.exe executable is in "C:\Program Files\MATLAB\Rrelease\sys\perl\win32\bin\perl.exe" where release will be something like 2020b. You only need to do this once - after that any of the .command scripts should open with MATLAB's Perl.

On Windows, if you do not have MATLAB but you have Anaconda the you can install Perl via conda. At the Anaconda Prompt type "conda install perl". The first time you install alphaMELTS you need to do right-click install2.command and do "Open with..." and choose the Perl within Anaconda. The perl.exe executable should be in  "C:\Users\username\Anaconda3\Library\bin\perl.exe" where username is your Windows username.

If you have neither MATLAB or Anaconda you can install any other version of Perl. We recommend Strawberry Perl. First check that Perl is not already installed by opening the Command Prompt (cmd.exe) and typing 'perl -v'. If you get a message like "'perl' is not recognized as an internal or external command, operable program or batch file", then either:
  • Download the portable version of Strawberry Perl. Double-click the archive to extract the files and, optionally, move the folder to a more convenient location on your hard disk.
               ... or ...
  • Download the MSI installer for ActivePerl or for Strawberry Perl. As a user with admin privileges double-click the installer and follow any instructions.
alphaMELTS should work fine with any version of Perl.

WARNING: if you have ActivePerl or the not 'portable' version of Strawberry Perl installed then you should use this perl.exe to open the alphaMELTS installation script (and not the perl.exe inside MATLAB or the one in the portable version of Strawberry Perl).

If required, install2.command will do some configuration to make sure that command line switches, such as '-f settings_file', are recognised by Perl (see this post). It will then associate the '.command' file extension with your chosen 'perl.exe'. Then if you double-click a '.command' script or type its name at the command line then Perl will open automatically. Except for the very first time you open install.command you do not need to load the Perl program manually.

Occasionally install2.command is not able to associate the .command files with your chosen Perl. For example, the machine may be university-administered. Whatever you do, when you go to run run-alphamelts.command it asks what to use to open the file, and if you select the Perl interpreter you get a Permissions error because you have opened run-alphamelts.command where perl.exe is located. As a workaround, after running install2.command copy run-alphamelts.command, file-format.command and column-pick.command to the links_folder (C:\Users\username\Documents\bin if you took the default settings). You should find that you can now run alphaMELTS in double-click mode. Double-click run-alphamelts.command (not alphamelts2), select the Perl interpreter and then enter your command line switches when it asks.

To check the path after running install2.command:

Once you have logged out and in, if prompted to do so, then:
  • Double click install2.command and the PATH variable will displayed at the top. Close the window with the 'x'.
               ... or ...
  • Double click install2.command. Choose 'y' the to the first "Continue with Installation?" question to test whether links_folder specifically is in your path and then choose 'n' to the second "Continue with Installation?" to abort another installation.
               ... or ...
  • On Windows, at the Command Prompt type 'echo %PATH%'.
    • On Mac or Linux, at the Terminal type 'echo $PATH'.
To edit the path on Windows, for example if you change the location of the links_folder to new_folder:

WARNING: if you do not understand what the Path variable does then please do not try to edit it!!! This is especially important on Windows as it's harder to undo any changes. You can always use alphaMELTS in double-click / drag-and-drop mode on Windows even if the links_folder is not in your Path.

First open the Windows settings. Type "environment" in the search box and then choose "Edit environment variables for your account". Select Path under "User variables for username", then "Edit...". Click New and add the location of your links_folder (C:\Users\username\Documents\bin if you took the default settings).

Note, please only edit the path if prompted to do so by install2.command or if you change the links_folder location after installation. Do not edit the System variable that is called 'Path'. If there is no User variable called 'Path' then please try running install2.command (again). It should create the 'Path' variable if it does not already exist.

There are plenty of websites and videos that will explain in more detail about the Path, and how to set it, and about file associations etc..  Googling "set path windows" and "file associations windows" will bring up several links.

Hope that helps,
Paula
[/list]