rcst / rim

rim provides an interface to Maxima for R. Maxima is a powerful and fairly complete computer algebra system.
10 stars 3 forks source link

library(rim) stuck on Windows #29

Closed asuender closed 2 years ago

asuender commented 2 years ago

Hello!

I've been trying to use this library on my Windows system, but R hangs every time I load it with library(rim). This problem only seems to occur on Windows machines; it works fine on Linux.

grafik

rcst commented 2 years ago

Thanks for reporting!

I‘ll try to replicate, just need to get a Windows 11 copy first. The package was tested last time on a Windows 10.

One thing you can try is to check whether Windows 11 has a firewall that prevents R/ Maxima from opening a port.

But I suspect it get‘s stuck parsing the greeting message for some reason. That has been the culprit in the past at least.

I‘ll get back soon.

Am 21.09.2022 um 22:58 schrieb Andreas Sünder @.***>:

 Hello!

I've been trying to use this library on my Windows system, but R hangs every time I load it with library(rim). This problem only seems to occur on Windows machines; it works fine on Linux.

Windows 11 Home 21H2 build 22000.978 Maxima version 5.45.1 (added to PATH) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

asuender commented 2 years ago

Thank you! A friend of mine tested your package as well (but on Windows 10), so I guess you won't need to get an extra Win 11 copy 😄 .

To your knowledge, has this problem ever occurred before on Windows?

rcst commented 2 years ago

I could replicate this issue. You were right, it also happens on Windows 10, specifically, when the package is installed into a path that contains spaces.

Can you try if it works?

asuender commented 2 years ago

I just tried to install the newest version, but now there seems to be another problem:

> remotes::install_github("rcst/rim")
...
** testing if installed package can be loaded from temporary location
Error: Laden von Paket oder Namensraum für 'rim': fehlgeschlagen
 .onAttach in attachNamespace() für 'rim' fehlgeschlagen, Details:
  Aufruf: initialize(...)
  Fehler: Detected default prompt - failed to initialize Maxima.
Fehler: Laden fehlgeschlagen
Ausführung angehalten
ERROR: loading failed
* removing 'C:/Program Files/R/R-4.2.1/library/rim'
Warning message:
In i.p(...) :
  Installation des Pakets ‘C:/Users/andis/AppData/Local/Temp/Rtmp6R7Gcf/file27d074de4206/rim_0.5.1.tar.gz’ hatte Exit-Status ungleich 0
rcst commented 2 years ago

The previous warnings indicate that there are/ were permission issues with copying files. But I suspect you ruled this out?

I need a bit of your help, if you don't mind.

rim basically calls Maxima with the following parameters to setup the connection:

maxima --userdir=[inst/extdata] --init=display

where [inst/extdata] is a directory (in this repo) that contains file display.mac. Initializing Maxima with this re-configures it's prompt and output format, which fails in your case, hence the error that the default prompt was detected. The previous commit implemented the throwing of 3 new error conditions of which you caught the first one.

Could you try run maxima and initialize using this file manually? When I fixed it under my Windows 10 setup, the problem was that the directory path as found by R using system.file("extdata", "display.mac", package = "rim") outputs a path containing white spaces. Under windows, the path to [inst/extdata] is now converted into DOS 8+3 folder format done by function shortPathName(). If you could experiment a bit with the right path, I'd be glad not having to install Windows 11.

asuender commented 2 years ago

The previous warnings indicate that there are/ were permission issues with copying files. But I suspect you ruled this out?

Yeah, I figured that one out. There were some permissions issues in my AppData folder (which is btw the default package installation folder), so I changed this with an env variable to point to a different location.

I believe --userdir= is causing the problem. I tried several times to launch maxima from the console and initialize it with the --init parameter, but that doesn't work. Usually, at least that's what I think, maxima searches for the specified init file (set via --init=<file>) in a specific location provided by the --userdir<dir> parameter. Because of the fact that changing the user directory doesn't seem to work, maxima switches back to the default one (which is %USERPROFILE%/maxima) without any warnings or errors.

asuender commented 2 years ago

Update: I found a workaround for this: since --userdir<dir> doesn't work, I copied display.mac to the default user directory, and now it works!

rcst commented 2 years ago

Glad you found a way. However, I hope we can do better, as others are likely to face the same issue.

One thing I’d be interested for you to try out is, whether setting the parameter to —userdir= (note that it’s with “=“) in quotation marks. Also Maxima uses forward slash to separate sub-folders, otherwise it definitely won’t work.

If those things still don’t work, it may be worth report this as an issue to the Maxima developers.

Am 02.10.2022 um 21:41 schrieb Andreas Sünder @.***>:

 Update: I found a workaround for this: since --userdir

doesn't work, I copied display.mac to the default user directory, not it works!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

asuender commented 2 years ago

Well, I tried what you suggested in various ways, but it still doesn't work. As you said, it may be worth reporting this as an issue to the developers of maxima.

rcst commented 2 years ago

This has now been discussed on the Maxima discuss mailist.

Someone said, sorry and will fix it in sometime. Indeed after this related commit, Maxima started to only load init files from Maxima home directory.

So it should work once there is a new version, so it's also out of scope for this package. I'll close it hence.