Loading R libraries in 2.10.4

I am using a workflow which previously worked in version 9 using the Deprecated "TableR-View Node"

Changing this to the new interactive R View(Table) it is failing to load a required R library

"there is no package called 'qpcR'

My first lines of R script are 

require(qpcR)
library(qpcR)

My R version has not changed, and the package is installed in my R installation

Any thoughts?

Thanks,

Mark

1 Like

I guess the KNIME node is using the R distribution bundled with KNIME. Have a look at the preferences, there you can set the path to the R installation.

Hi Thor,

No I've got the same R path as I used with the previous version of KNIME, no joy.

It just refuses to load packages. for instance:

> require(qpcR)
Loading required package: qpcR
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
  there is no package called 'qpcR'
> library(qpcR)
Error in library(qpcR) : there is no package called 'qpcR'

I KNOW that this package is available in R as I can run the script in R, the same R installaion as I am pointing R at. This is highly frustrating as I do most of my R inside KNIME

Cheers,

Mark

 

BTW I've just upgraded to 2.11.0 still the same problem.

SOLVED

It turns out a reboot of KNIME solves the problem so its an intermittent problem

Actually NOT SOLVED

I could get R libraries working with the older deprecated nodes but the ne R nodes I still cannot load any libraries.

I installed a fresh copy of R yesterday version 3.1.2, pointed KNIME at that and I am still getting "Error in Library X: theres is no package called 'X'

Where X is any R library

Quite frustrating.

Hi,

Perhaps you could look at this : https://tech.knime.org/node/45896/view

The plot thickens, going back  to using KNIME 2.9.4 the R(Labs) and setting the preferences to C:\Program Files\R\R-3.1.2 gave me an error message:

ERROR     R View (Table)                     Execute failed: Only R in version 2.x is supported. The R installation defined in the preferences is of version 3.x.
You can fix the problem by pointing to a valid R v2 installation or by
 - uninstalling the feature "org.knime.features.rengine.r2"
 - modifying your R installation and adding the package "rJava" (available from CRAN)
 - add a line to knime.ini: -Djava.library.path=<R-install-folder>/library/rJava/jri/x64
   (path printed to console while running install.packages("rJava") in R)
and restarting KNIME

Going back to R 2.11.0 and pointing the R preferences to C:\Program Files\R\R-2.15.2 

it STILL does not work !! I get the usual error message....

ERROR     R Snippet                          java.lang.IllegalStateException: Execution of R script failed: Error in library(chemCal) : there is no package called 'chemCal'
ERROR     R View (Table)                     Execute failed: Execution of R script failed: Error in library(chemCal) : there is no package called 'chemCal'

 

I've checked that in R-2.15.2 the package is loaded and works.

I will now try teh second option..

 

Hi,

I had a similar problem. So, I followed the path in the knime preference for R, I found where exactly where imported the library (they weren't in this directory in fact). But it worked from what I tought was the right R directory in Knime through the R Gui. For me the right directory was : C:\Program Files\KNIME_2.10.4\plugins\org.knime.ext.r3.bin.win32.x86_3.0.3.0044664\R-Inst\library. I downloaded my R library zip files and unzipped them at the right place using the workflow above : https://tech.knime.org/node/45896/view

I haven't found yet the origin of this problem due to multiple R installations.

I have finally solved this problem!

if you are not running R as Admin in Windows 7 it puts your R libraries in your "My Documents" area. Copying these to the default area where R puts its libraries solves the problem. Obviously you need admin rights to copy to this location.

 

1 Like

Thanks for that !

Exactly what I was looking for. Thanks a lot

Thanks a lot Mark. In my case as the library was already installed, I installed it from its directory under My Documents.

library("XML", lib.loc="C:/Users/ece.o/Documents/R/win-library/3.1")

Muchas gracias, excelente solución