ComputationalThermodynamics / MAGEMin

The parallel Mineral Assemblage Gibbs Energy Minimization package
GNU General Public License v3.0
71 stars 17 forks source link

Installation of MAGEMin_jll julia package fails #9

Closed bobmyhill closed 2 years ago

bobmyhill commented 2 years ago

Trying to install MAGEMin for use in MatLab on a MacBook Pro (Apple Silicon M1). Julia installs fine from the website. Failure on Step 2/3 of the installation. Error message below.

.../bin/MAGEMin: line 1: 0: command not found
.../bin/MAGEMin: line 2: 0: command not found
...
.../bin/MAGEMin: line 793: 0: command not found
ERROR: LoadError: failed process: Process(setenv(/Users/rm16686/.julia/artifacts/e70959efeb45550c881b6c06c67c6fa3761a6ef3/bin/MAGEMin --version,["XPC_FLAGS=0x0", "COMMAND_MODE=unix2003", "PATH=/Users/rm16686/.julia/artifacts/9bfa7faf9a21863f996d8317bd5936e051971bd6/bin:/Users/rm16686/.julia/artifacts/e70959efeb45550c881b6c06c67c6fa3761a6ef3/bin:/usr/bin:/bin:/usr/sbin:/sbin", "PWD=/Users/rm16686/software/MAGEMin-main", "ZES_ENABLE_SYSMAN=1", "DISPLAY=/private/tmp/com.apple.launchd.9uNmdKH5CI/org.xquartz:0", "XPC_SERVICE_NAME=application.com.mathworks.matlab.2923756.3028661", "SHELL=/bin/bash", "DYLD_FALLBACK_LIBRARY_PATH=/Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia:/Users/rm16686/.julia/artifacts/9bfa7faf9a21863f996d8317bd5936e051971bd6/lib:/Users/rm16686/.julia/artifacts/900c5f3ba53bb0d128142a78da39027c65597b0f/lib:/Users/rm16686/.julia/artifacts/bf797a6e6d1fcc01635d6b2723ac0390c82f41d2/lib:/Users/rm16686/.julia/artifacts/e70959efeb45550c881b6c06c67c6fa3761a6ef3/lib:/Applications/Julia-1.7.app/Contents/Resources/julia/bin/../lib/julia:/Applications/Julia-1.7.app/Contents/Resources/julia/bin/../lib:/Users/rm16686/lib:/usr/local/lib:/lib:/usr/lib", "__CF_USER_TEXT_ENCODING=0x1F7:0:2"  …  "__KMP_REGISTERED_LIB_54923=0x12d0da1a8-cafe5101-libiomp5.dylib", "_=/Applications/Julia-1.7.app/Contents/Resources/julia/bin/julia", "KMP_HANDLE_SIGNALS=0", "KMP_BLOCKTIME=1", "USER=rm16686", "LC_NUMERIC=C", "TERM=dumb", "MKL_NUM_THREADS=", "HOME=/Users/rm16686", "OPENBLAS_MAIN_FREE=1"]), ProcessExited(127)) [127]

Stacktrace:
 [1] pipeline_error
   @ ./process.jl:531 [inlined]
 [2] run(::Cmd; wait::Bool)
   @ Base ./process.jl:446
 [3] run(::Cmd)
   @ Base ./process.jl:444
 [4] top-level scope
   @ ~/software/MAGEMin-main/julia/install_MAGEMin.jl:30
in expression starting at /Users/rm16686/software/MAGEMin-main/julia/install_MAGEMin.jl:30

ans =

     1
boriskaus commented 2 years ago

yes apologies.

We have an issue with the current version of MAGEMin distributed through BinaryBuilder (I accidentally pushed a version with a bug yesterday). We are trying to get that fixed and preventing such things from happening in the future.

Meanwhile, a temporary fix is by installing an older version of MAGEMin in julia:

julia> ]
pkg> rm MAGEMin_jll
pkg> add MAGEMin_jll@1.0.1
julia> using MAGEMin_jll
julia> julia> run(`$(MAGEMin())`)
Running MAGEMin 1.0.1 on 1 cores {
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

VOL_SYS           +1.582647
RHO_SYS           +3253.910274
MASS_RES          +0.000010
Rank          : 0 
Point         : 0 
Temperature   : 1100.0000        [C] 
Pressure      : 12.00    [kbar]

SOLUTION: [G = -825.337] (37 iterations, 533.84 ms)
[-1011.909244,-1829.091667,-819.265695,-695.468293,-412.942264,-971.879593,-876.528204,-1073.651398,-276.626122,-1380.314700,]
 opx     0.23184 
 cpx     0.15210 
 spn     0.01395 
  ol     0.60211 
Point             0
__________________________________
MAGEMin comp time: +764.156000 ms }

Once that works, you will have to manually change the file environmental_variables.m, where path_bin and path_dylib likely need to be updated:

julia> path_bin = MAGEMin_jll.__init__()
"/Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia:/Users/kausb/.julia/artifacts/1de252c3f8c1eeb3c18189b1a27222e8dc806171/lib:/Users/kausb/.julia/artifacts/3de79395eef7694a5f90e9feb05eb575a59e69ae/lib:/Users/kausb/.julia/artifacts/c75423ee5adba82a5653ec3bee4687a1ac9b49d7/lib:/Users/kausb/.julia/artifacts/94a7ccc74e461921cd83f8373adb592647d3cf53/lib:/Applications/Julia-1.7.app/Contents/Resources/julia/bin/../lib/julia:/Applications/Julia-1.7.app/Contents/Resources/julia/bin/../lib"

julia> path_dylib = MAGEMin_jll.__init__()
"/Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia:/Users/kausb/.julia/artifacts/1de252c3f8c1eeb3c18189b1a27222e8dc806171/lib:/Users/kausb/.julia/artifacts/3de79395eef7694a5f90e9feb05eb575a59e69ae/lib:/Users/kausb/.julia/artifacts/c75423ee5adba82a5653ec3bee4687a1ac9b49d7/lib:/Users/kausb/.julia/artifacts/94a7ccc74e461921cd83f8373adb592647d3cf53/lib:/Applications/Julia-1.7.app/Contents/Resources/julia/bin/../lib/julia:/Applications/Julia-1.7.app/Contents/Resources/julia/bin/../lib"
bobmyhill commented 2 years ago

Thanks for the quick reply and for making the fixes. I tried your workaround (above) and I also tried running your new version 1.0.6.

Both of these versions successfully run the single test point from run($(MAGEMin())) or from the end of the setup GUI. However, when trying to compute the standard KLB-1 section from MATLAB I get a different error with the following message:

Error using sscanf
First argument must be a text scalar.

Error in ReadData_MAGEMin (line 34)
    A       = sscanf(line,'%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f');

Error in PerformMAGEMin_Simulation (line 148)
                PhaseData_in1   = ReadData_MAGEMin(1:2,[],Computation.MinPhaseFraction);

Error in ComputePhaseDiagrams_AMR (line 124)
    [PhaseData, TP_vec, FailedSimulations, CancelComputation] = PerformMAGEMin_Simulation(PhaseData, newPoints, TP_vec, VerboseLevel, Chemistry, dlg, ComputeAllPoints, UseGammaEstimation, Computation);

Error in PlotPseudosection/StartNewComputation (line 1423)
            [PseudoSectionData, CancelComputation]       =   ComputePhaseDiagrams_AMR(PseudoSectionData, DisplayPlots);

Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 427)
Error while evaluating Button PrivateButtonPushedFcn.
boriskaus commented 2 years ago

Yes, this is because you need to restart the GUI after you installed MAGEMin for the first time. I now updated the GUI to show a message that tells you this after installation (together with some more fixes). You can get it if you download the repo using the green button.

thanks for your interest & checking!