WolframResearch / wolfram-app-discovery-rs

Locate local installations of the Wolfram Language.
Apache License 2.0
14 stars 5 forks source link

Linux: could not find installation #51

Open simonbyrne opened 1 year ago

simonbyrne commented 1 year ago

I tried using this on our local cluster (Linux), which provides several different Mathematica versions via modules. I tried it with Mathematica 12.3 (which happened to be the most recent version available).

  1. It was initially unable to find the installation:

    $ wolfram-app-discovery default
    warning: error looking for Wolfram apps in '/usr/local/Wolfram': No such file or directory (os error 2)
    warning: error looking for Wolfram apps in '/opt/Wolfram': No such file or directory (os error 2)
    Error: Error(Undiscoverable { resource: "default Wolfram Language installation", environment_variable:    Some("WOLFRAM_APP_DIRECTORY") })

    this is despite the binary directory being in the PATH. For example:

    WolframKernel -noprompt -run "WriteString[\$Output,\$InstallationDirectory];Exit[]"

    gives me the correct directory.

  2. I then set the WOLFRAM_APP_DIRECTORY environment variable. This then gave the following error:

    $ wolfram-app-discovery default
    Error: Error(Other("Unable to determine Wolfram app type from LICENSE.txt: first line was: \"Wolfram Mathematica License Agreement\""))
ConnorGray commented 1 year ago

Hi Simon, thanks for filing this issue.

Re. (1) wolfram-app-discovery doesn't currently check for any Wolfram executables on PATH other than wolframscript. In your use-case, is WolframKernel specifically the only executable you'd expect wolfram-app-discovery to be able to use to find local Wolfram installations? I think that seems like a reasonable feature.

Re. (2) This is bug in wolfram-app-discovery. Currently on Linux there isn't any kind of common app metadata file that can be read to determine the precise app type, so as the quoted error message suggests, wolfram-app-discovery falls back to trying to parse LICENSE.txt, which is one of the few places where our build process embeds the precise name of the app.

I'll make a PR updating wolfram-app-discovery to recognize the quoted line as Mathematica and ping this issue when that's done.

ConnorGray commented 1 year ago

Hi Simon, I've implemented a fix for your (2) issue (PR #52), and published wolfram-app-discovery v0.4.4 with the fix.

Let me know if (2) still persists with this new version.

Fixing (1) will require a little bit more thought than I can implement in a quick fix like this, but seems fundamentally doable.

simonbyrne commented 1 year ago

Thanks!

There are 3 installations of mathematica on our cluster (11.1, 12.0, 12.3). 12.0 and 12.3 have the following execuables in the bin directory (which is the one the module puts in the PATH):

math  mathematica  Mathematica  MathKernel  mcc  wolfram  WolframKernel

and 11.1 has the following

math         Mathematica        MathKernel  wolfram        wolframscript
mathematica  MathematicaScript  mcc         WolframKernel  WolframScript

Interestingly, on 12.0 and 12.3, the Executables directory has

math  mathematica  Mathematica  MathKernel  mcc  wolfram  WolframKernel  wolframscript

but not on 11.1, which only has:

math  mathematica  Mathematica  MathKernel  mcc  wolfram  WolframKernel