none
package or namespace load failed for 'Hmisc' in REMOTE Session RRS feed

  • Question

  • I have installed r-9.0.1 Standalone version on the server. finished the operationalization setup. I am able to access the server using RClient/ROpen using mrsDeploy  and able to see/publish the R Scripts. 

    I have installed HMISC package without error. When I go to Physical Server I can execute my code without error which uses this Package internally. But I am not able to even load the library in REMOTE session. Attached is the Console Output of the Remote session I tried from my local desktop to Server. Can someone Help me Please...

    Console Output:

    > remoteLogin("http://RemoteServer:12800", username = "adminmistrator",password = "somepassword")

    Diff report between local and remote R sessions...

    Local and Remote R versions are the same: R version 3.3.2 (2016-10-31)

    These R packages installed on the local machine are not on the remote R instance:

       Missing Packages

    1             abind

    2               AER

    ....

    The versions of these installed R packages differ:

             Package       Local      Remote

    1            car       2.1-4       2.1-3

    2          chron      2.3-48      2.3-47

    3     colorspace       1.3-2       1.2-7

    4           curl         2.3         2.2

    5     data.table      1.10.0       1.9.6

    6       DEoptimR       1.0-8       1.0-6

    7        ggplot2       2.2.1       2.1.0

    8          Hmisc       4.0-2      3.17-4

    9       jsonlite         1.2         1.1

    10          Rcpp      0.12.8      0.12.7

    11 RcppArmadillo 0.7.600.1.0 0.7.500.0.0

    12    robustbase      0.92-7      0.92-6

    13      sampling         2.8         2.7

    14        scales       0.4.1       0.4.0

    15            sp       1.2-4       1.2-3

    16       SparseM        1.74        1.72

    17      survival      2.40-1      2.39-5

    18           zoo      1.7-14      1.7-13

    Your REMOTE R session is now active.

    Commands: 

            - pause() to switch to local session & leave remote session on hold.

            - resume() to return to remote session.

            - exit to leave (and terminate) remote session.

    REMOTE> .libPaths()

    [1] "C:/Program Files/Microsoft/R Server/R_SERVER/library"

    REMOTE> getwd()

    [1] "C:/Program Files/Microsoft/R Server/R_SERVER/DeployR/rserve/workdir/conn4024"

    REMOTE> library(Hmisc)

    Error: package or namespace load failed for 'Hmisc'

    REMOTE> list.files("C:/Program Files/Microsoft/R Server/R_SERVER/library")

      [1] "acepack"              "Amelia"               "base"               

      [16] "cvTools"              "data.table"           "dataAnalysis"       

     [31] "foreign"              "Formula"              "fpc"                

      [37] "grDevices"            "grid"                 "gridExtra"          

     [40] "gtable"               "Hmisc"                "iterators"          

     [133] "trimcluster"          "utils"                "vcd"                

    [136] "VIM"                  "xts"                  "zoo"                

     

    REMOTE> .libPaths()

    [1] "C:/Program Files/Microsoft/R Server/R_SERVER/library"

     

    REMOTE> library(Hmisc)

    Error: package or namespace load failed for 'Hmisc'

    REMOTE>


    satyaganti


    • Edited by Satyaganti Monday, March 27, 2017 12:45 PM fixed the typo
    Monday, March 27, 2017 12:41 PM

Answers

  • I think you've already heard, but here is the answer:

    The problem may be with one of the Hmisc dependency packages:  "data.table".  The error occurs because data.table wants to unlock the binding of the "base" environment when it loads, and R Server in a remote context doesn’t allow that.  There is a workaround.
     
    1.  On your Windows machine that is running R Server, go to the following directory:  "C:\Program Files\Microsoft\R Server\R_SERVER\DeployR\Rserve\RScripts"
    2.  Comment the following lines in the file "source.R"
          #  unlockBinding("unlockBinding",b)
          #  assign("unlockBinding", deployr.unlock, envir=b)
          #  lockBinding("unlockBinding", b)
     
    3.  Open "Services" Window on the machine running R Server
    4   Restart the service "Rserve9.0.0.0"
    5.  From your R client, login to the server again and establish a new remote session.
    6.  Install and load the package:
          REMOTE> install.packages("Hmisc")
          REMOTE> library(Hmisc, lib.loc=getwd())
     
    These workarounds won't be needed in our next release. :-)
     
    Thanks

    Tuesday, March 28, 2017 3:13 AM
    Moderator

All replies

  • Hello,

    There may be an issue that we'll fix soon. Can you try the following:

    When loading a library for the REMOTE session, try to see if setting lib.loc=getwd() solves the problem for now as such:

    library("<packagename>", lib.loc=getwd())

     Thanks,
    Monday, March 27, 2017 2:27 PM
    Moderator
  • No.

    It did not solve for me. Here is the results of console output....

    REMOTE> getwd()
    [1] "C:/Program Files/Microsoft/R Server/R_SERVER/DeployR/rserve/workdir/conn3400"

    REMOTE> .libPaths()
    [1] "C:/Program Files/Microsoft/R Server/R_SERVER/library"

    REMOTE> library("Hmisc", lib.loc=getwd())
    Error in library("Hmisc", lib.loc = getwd()) : 
      there is no package called 'Hmisc'
    REMOTE> library("Hmisc", lib.loc="C:/Program Files/Microsoft/R Server/R_SERVER/library")
    Error: package or namespace load failed for 'Hmisc'
    REMOTE> install.packages("Hmisc")
    Installing package into 'C:/Program Files/Microsoft/R Server/R_SERVER/DeployR/Rserve/workdir/conn3400'

    (as 'lib' is unspecified)

    trying URL 'https://mran.revolutionanalytics.com/snapshot/2016-11-01/bin/windows/contrib/3.3/Hmisc_3.17-4.zip'

    Content type 'application/zip' length 1642190 bytes (1.6 MB)

    ==================================================

    downloaded 1.6 MB



    package 'Hmisc' successfully unpacked and MD5 sums checked



    The downloaded binary packages are in

            C:\Program Files\Microsoft\R Server\R_SERVER\DeployR\Rserve\workdir\tmp\RtmpolTIxi\downloaded_packages


    REMOTE> library("Hmisc", lib.loc=getwd())
    Error: package or namespace load failed for 'Hmisc'
    REMOTE> library("Hmisc")
    Error: package or namespace load failed for 'Hmisc'
    REMOTE> library(Hmisc)
    Error: package or namespace load failed for 'Hmisc'
    REMOTE> 


    satyaganti

    Monday, March 27, 2017 5:02 PM
  • I think you've already heard, but here is the answer:

    The problem may be with one of the Hmisc dependency packages:  "data.table".  The error occurs because data.table wants to unlock the binding of the "base" environment when it loads, and R Server in a remote context doesn’t allow that.  There is a workaround.
     
    1.  On your Windows machine that is running R Server, go to the following directory:  "C:\Program Files\Microsoft\R Server\R_SERVER\DeployR\Rserve\RScripts"
    2.  Comment the following lines in the file "source.R"
          #  unlockBinding("unlockBinding",b)
          #  assign("unlockBinding", deployr.unlock, envir=b)
          #  lockBinding("unlockBinding", b)
     
    3.  Open "Services" Window on the machine running R Server
    4   Restart the service "Rserve9.0.0.0"
    5.  From your R client, login to the server again and establish a new remote session.
    6.  Install and load the package:
          REMOTE> install.packages("Hmisc")
          REMOTE> library(Hmisc, lib.loc=getwd())
     
    These workarounds won't be needed in our next release. :-)
     
    Thanks

    Tuesday, March 28, 2017 3:13 AM
    Moderator
  • Thanks a lot... this helped us.

    satyaganti

    Tuesday, March 28, 2017 3:38 AM