jconway / plr

PL/R - R Procedural Language for PostgreSQL
http://www.joeconway.com
90 stars 42 forks source link

unable to load certain libraries in plr Windows 10 #27

Closed ralikwen closed 7 years ago

ralikwen commented 8 years ago

I am unable to load certain libraries in plr in windows 10. They fail with the following error message:

ERROR:  R interpreter expression evaluation error
DETAIL:  Error: package or namespace load failed for '[libname]'
CONTEXT:  In PL/R function export

Libraries so far that I found to fail are: reshape, reshape2, lattice, hexbin, testthat, Matrix These libraries are usable from R itself. At the same time other libraries installed the same way, and located at the same place load with no problem, eg: curl, foreach, MASS, knitr, yaml

I am running

Postgres 9.4 on Windows 10
R - 3.3.1
dir: C:\Program Files\R\R-3.3.1\library
R_HOME from Select * From plr_environ() is C:\Program Files\R\R-3.3.1

I also tried this with Postgres 9.5 and got the same error. There is no similar problem on my production Debian machine. I don't even know where to begin investigating.

(I have sent this same message to the mailing list as well. I am sorry for double posting but I am uncertain now what forum should I be using for issues.)

Thanks for any help. Balázs

davecramer commented 8 years ago

So the real challenge we have with this is finding a windows 10 box to debug on.

I suspect what is happening is a library load error within the modules that aren't loading but have no way of verifying that.

Dave Cramer

On 21 September 2016 at 04:41, Balázs Klein notifications@github.com wrote:

I am unable to load certain libraries in plr in windows 10. They fail with the following error message:

ERROR: R interpreter expression evaluation error DETAIL: Error: package or namespace load failed for '[libname]' CONTEXT: In PL/R function export

Libraries so far that I found to fail are: reshape, reshape2, lattice, hexbin, testthat, Matrix These libraries are usable from R itself. At the same time other libraries installed the same way, and located at the same place load with no problem, eg: curl, foreach, MASS, knitr, yaml

I am running

Postgres 9.4 on Windows 10 R - 3.3.1 dir: C:\Program Files\R\R-3.3.1\library R_HOME from Select * From plr_environ() is C:\Program Files\R\R-3.3.1

I also tried this with Postgres 9.5 and got the same error. There is no similar problem on my production Debian machine. I don't even know where to begin investigating.

(I have sent this same message to the mailing list as well. I am sorry for double posting but I am uncertain now what forum should I be using for issues.)

Thanks for any help. Balázs

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jconway/plr/issues/27, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYz9r2ZNUq-9ENYRgEWTNemCVMAwxO-ks5qsO2ggaJpZM4KCilS .

ralikwen commented 8 years ago

Unfortunately I am completely unfamiliar with debugging. Is there a log, dump or similar file that I could send or look at to untangle this?

davecramer commented 8 years ago

Unfortunately no.

Could you try creating an R program which attempts to load the same libraries directly in R run from the command line ? Admittedly this is a hail mary.

Dave Cramer

On 21 September 2016 at 08:58, Balázs Klein notifications@github.com wrote:

Unfortunately I am completely unfamiliar with debugging. Is there a log, dump or similar file that I could send or look at to untangle this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jconway/plr/issues/27#issuecomment-248604347, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYz9n9lBOuhub5RIQX7j6T9VnL-_A_pks5qsSn6gaJpZM4KCilS .

ralikwen commented 8 years ago

the single line library('reshape2') executes without error in RStudio or in the R command line but fails within a plr function

jconway commented 8 years ago

Can you try this either with the R path "C:\R\R-3.3.1\library" (no spaces) on your Windows box, or alternatively using path "/Program Files/R/R-3.3.1/library" (with space in path) on a Debian system to see how it behaves? I can try the latter at some point but will not have time for a while...

ralikwen commented 8 years ago

I can try the former one. Will let you know about the results.

ralikwen commented 8 years ago

I uninstalled and reinstalled R into "C:\R\R-3.3.1\" and changed the R_HOME variable. SELECT * FROM plr_environ() returns now with the new R_HOME value. Unfortunately the error remains: in a plr function library('catR') returns OK, but library('reshape2') gives the same error as before.

jconway commented 7 years ago

All of the failing packages look like they import other packages, whereas the ones that do not fail are standalone -- is that correct? Since the imported packages are also in DLL files, please try putting the R library directory (location of all of these package DLLs) into your system PATH environment variable. If I remember correctly I have seen that needed before.

ralikwen commented 7 years ago

Thanks for the idea, I have now tried that, but unfortunately it did not help.

I now have the following directories in my system PATH variable: C:\R\R-3.3.1 C:\R\R-3.3.1\bin\x64; C:\R\R-3.3.1\library\reshape2\libs\x64; C:\R\R-3.3.1\library\reshape2\libs; C:\R\R-3.3.1\library\reshape2; C:\R\R-3.3.1\library\;

also tried adding: C:\R\R-3.3.1\library\reshape2\libs\i386;

I restarted the machine.

library(catR) succeeds, but library(reshape2) - still fails.

Please let me know if there is anything else I could try. Thx.

jconway commented 7 years ago

Yesterday I tried library('lattice') in a plr function on my own Win10 VM and it loaded perfectly, even though I do not have the DLL dirs in the PATH. So apparently that is not the issue.

Is there anything none standard with your install other than moving the installation directory? I assume you got the R via CRAN for example?

ralikwen commented 7 years ago

library('lattice') runs fine for me too could you try library('reshape') - that fails for me I don't think I have anything non-standard with my R installation

jconway commented 7 years ago

sorry for the long delay, but this works fine for me also so I am still at a loss as to what the problem could be:

CREATE OR REPLACE FUNCTION public.testplr() RETURNS text AS $BODY$library('reshape'); return ("ok")$BODY$ LANGUAGE plr;

ralikwen commented 7 years ago

if that works fine on your box than it must be something with the setup of mine sorry for the bother