Question

RCaller - "no package called sqldf'

  • 4 February 2020
  • 4 replies
  • 128 views

Badge +21

Hi!

 

There are multiple tips on how to solve this issue. I think I have tried them all, but just to document and see if I have skipped some part.

Challenge: You get the error message when trying to run an RCaller:

2020-02-04 08:36:56|   0.6|  0.0|ERROR |RCaller_2 (InlineQueryFactory): Failed with exit code 1 when executing R script. Output was: Error in library("sqldf") : there is no package called 'sqldf'

 

Solution

1. Check if sqldf is installed correctly:

Do:

  1. Start cmd.bat / command line in "ADMINISTRATOR MODE"
  2. Navigate to where R is installed and the 32 or 64-bit R. Same version as your FME (I have 64-bit): C:\Program Files\R\R-3.6.1\bin\x64
  3. run R.exe
  4. Run and select your closes mirror
install.packages("sqldf")

The reply for my pat is:

> install.packages("sqldf")
Installing package into 'C:/Users/XXXX/Documents/R/win-library/3.6'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cran.uib.no/bin/windows/contrib/3.6/sqldf_0.4-11.zip'
Content type 'application/zip' length 78436 bytes (76 KB)
downloaded 76 KB

package 'sqldf' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\XXX\AppData\Local\Temp\RtmpW60Obp\downloaded_packages
>

Now when I run

.libPaths()

The new package is NOT listed:

> .libPaths()
[1] "C:/Users/nosihg/Documents/R/win-library/3.6"
[2] "C:/Program Files/R/R-3.6.1/library"

So I am guessing the package does not get installed since it is not listed

 

I also tried the optional approach:

Optionally, you can place your R libraries in a shared resources folder. The location of this folder is set in Workbench under Tools > FME Options > Default Paths > Shared FME Folders.
In Windows, the R folder is located by default in Documents > FME > Plugins.
Additional modules dropped into the R folder will be picked up by FME.

 

0684Q00000ArCC2QAN.png

However not sure if they can be zipped or needs to be unzipped etc. And if they can be on a network folder or not.

0684Q00000ArC7AQAV.png


4 replies

Badge +21

Using this commandline:

install.packages("sqldf,RSQLite,memoise,digest,chron,pkgconfig,raster",dependencies=TRUE, lib="C:/Program Files/R/R-3.6.2/library")

Seems to be better:

- Install library sqldf

- Install all dependendent libraries

- Use the system-wide folder to install them (and NOT the user library)

I did a fresh install of R from our IT-department. That might be missing some default packages it seems. And when FME complained about missing packages it did not seem to solve the issue to have dependencies=TRUE so I guess these 6 packages are "independent" of each other but needed to work.

Just a heads up for anyone else trying to use RCaller!

Badge +21

Does anyone have a working "Hello world" script of R in FME? A workspace that just runs to verify the installation is OK on my part? Similar to below (but its just giving: Failed with exit code 1 when executing R script. Output was: Error: package 'gsubfn' required by 'sqldf' could not be found)

 

Not sure if it is a syntax error, installation error, R-error or other error.... Seems to work fine in RStudio

 

Badge +21

> library(sqldf)

Loading required package: gsubfn
Loading required package: proto
Loading required package: RSQLite
Error: package or namespace load failed for ‘RSQLite’:
 package ‘rlang’ does not have a namespace
Error: package ‘RSQLite’ could not be loaded

Not sure whats happening here - but seems to be some issues with the underlying RSQLite

Googling the error does not give me much to go on...

Badge +6

Posting for visibility. The issue here is that certain packages get installed into the User folder as opposed to the System folder(this is where R is generally Installed too).  Running the following CMD Line will install the packages to the R system library, thus eliminating the missing packages error in FME.

install.packages(c("sqldf","gsubfn","proto","DBI","Rcpp","bit64","bit","blob","vctrs","memoise","rgl","crosstalk","htmltools","shiny","httpuv","later","promises","mime","RSQLite","memoise","digest","chron","pkgconfig","raster","sp","rayshader","doParallel","foreach","iterators","ggplot2","gtable","scales","R6","lifecycle","munsell","colorspace","lazyeval","tibble","pillar","crayon","progress","hms","prettyunits","rayrender","magrittr","xtable","fastmap","htmlwidgets","jsonlite","knitr","xfun","manipulateWidget","webshot","miniUI","png"),dependencies=TRUE, lib="C:/Program Files/R/R-3.6.2/library")

Reply