microsoft / microsoft-r-open

Microsoft R Open Source
212 stars 69 forks source link

R load / capabilities("X11") hangs #50

Closed Javdat closed 6 years ago

Javdat commented 6 years ago

Recently my R stopped loading.

It will say R is loading and will be stuck there forever. I tried from Rstudio, directly from MRO GUI, and console. the same results.

Tried fully deleting and installing MRO (R version 3.3.3, Mac OS Sierra 10.12.6).

It will still not fully load. R --vanilla would run, so I tried to go down from R --no-site-file --no-init-file --no-environ --no-restore. Removing --no-site-file would break loading again.

Tracked down Rprofile.site to: /Library/Frameworks/R.framework/Versions/3.3.3-MRO/Resources/etc/Rprofile.site

Tried to run it by-hand. And R hangs when it reaches capabilities("X11") (Just capabilities() has the same result, something like capabilities("jpeg") would run normally).

Any suggestions?

if (!identical(system.file(package="RevoUtils"), "")) {
Revo.version <- RevoUtils:::makeRevoVersion()
repos.date <- utils::packageDescription("RevoUtils")$MRANDate
}

if (!identical(system.file(package="RevoScaleR"), "")) {
    if (.Platform$OS.type == "windows"){
        defaultRevoNodePath <- paste("C:\\Program Files\\Microsoft\\MRO-for-RRE\\", paste(Revo.version$major, substr(Revo.version$minor,1,1), sep="."), sep="")
        defaultRNodePath <- utils::shortPathName(R.home())
    } else {
        defaultRevoNodePath <- paste("/usr/lib64/MRS-", paste(Revo.version$major, substr(Revo.version$minor,1,1), sep="."), sep="")
        defaultRNodePath <- paste(defaultRevoNodePath, "/R-", paste(R.version$major, R.version$minor, sep="."), "/lib64/R", sep="")
    }
}

local(
{
    # set a CRAN mirror
    r <- getOption("repos")
    if (.Platform$OS.type == "unix") {
        options(download.file.method = "curl")
    }
    r["CRAN"] <- RevoUtils::getRevoRepos()
    options(repos=r)

    MRS.is.client <- RevoUtils:::isMicrosoftRClient()
    # set default packages
    # For MicrosoftML, check to see if this is a supported platform (Windows, RHEL/Cent 7, Ubuntu 14.04/16.04)
    isMMLSupported <- FALSE
    if (identical(.Platform$OS.type,"windows")) {
        isMMLSupported <- TRUE
    }
    if (identical(.Platform$OS.type, "unix") && length(grep("Ubuntu",Sys.info()["version"]))){
        if (file.exists("/etc/lsb-release")){
            UbuntuReleaseInfo <- scan("/etc/lsb-release", what="", sep="\n", quiet=TRUE)
            if (identical(UbuntuReleaseInfo[2], "DISTRIB_RELEASE=14.04") || identical(UbuntuReleaseInfo[2], "DISTRIB_RELEASE=16.04")) {
                isMMLSupported <- TRUE
            }
        }
    }
    if ( identical(.Platform$OS.type, "unix") && length(grep("el7.x86_64",Sys.info()["release"]))){
        isMMLSupported <- TRUE
    }

    if (!identical(system.file(package="RevoScaleR") , "")){
        options(defaultPackages=c(getOption("defaultPackages"), "rpart", "lattice", "RevoScaleR", 
            if(!identical(system.file(package="mrsdeploy"), "") && identical(.Platform$OS, "windows")) "mrsdeploy", 
            # we have MicrosoftML package
            if(!identical(system.file(package="MicrosoftML"),"") && isMMLSupported) "MicrosoftML", 
            "RevoMods", "RevoUtils", "RevoUtilsMath"))
        if (nchar(hostName <- Sys.getenv("REVOHADOOPHOST")) && nchar(portNumber <- Sys.getenv("REVOHADOOPPORT")))
        {
             RevoScaleR::rxHdfsConnect(hostName=hostName, portNumber=as.numeric(portNumber))
        }
    } 

    # branding information
    .RevoVersionShort <- Revo.version$version.string
    .RevoVersionShortLen <- regexpr("^.* \\d+\\.\\d+", .RevoVersionShort,  perl=TRUE)
    .RevoVersionShort <- substring(.RevoVersionShort, 1, attributes(.RevoVersionShortLen)$match)
    if ("setWindowTitle" %in% getNamespaceExports("utils")) {
        if (Revo.version$arch=="x86_64") {
            .RevoVersionShort <- paste(.RevoVersionShort, "(64-bit)")
        }
        try(utils::setWindowTitle(paste(" - ", .RevoVersionShort)), silent=TRUE)
    }
    if (.Platform$OS.type == "unix" && capabilities("X11")) {
        browseAvail <- Sys.which(c("firefox", "mozilla", "galeon", "opera", "xdg-open", "kfmclient", "gnome-moze-remote"))
        if (any(browseAvail != "")) {
            options(browser = browseAvail[which(browseAvail != "")[1]])
        }
    }

    if (.Platform$OS.type == "windows" ) { 
       options(help_type="html") 
    } 

    load_if_installed <- function(package) { 
       if (!identical(system.file(package="RevoUtilsMath"), "")) { 
       do.call('library', list(package)) 
       return(TRUE) 
       } else { 
          return(FALSE) 
       }  
    } 

    if (identical(system.file(package="RevoScaleR"), "")) {
        if (load_if_installed("RevoUtilsMath")) {
            ncores <- RevoUtilsMath::getMKLthreads()
        } else {
            MROversion <- paste(Revo.version$major, Revo.version$minor, sep=".")
            MKLmsg <- "No performance acceleration libraries were detected. To take advantage of \nthe available processing power, also install MKL for R Open. Visit \nhttp://go.microsoft.com/fwlink/?LinkID=698301 for more details.\n"
        }

        if (Sys.info()["sysname"] == "Darwin") {
            options(download.file.method = "libcurl") 
            hw.ncpu <- try(system('sysctl hw.physicalcpu', intern = TRUE)) 
            if (!inherits(hw.ncpu, "try-error")) { 
                ncores <- sub("hw.physicalcpu: ", "", hw.ncpu) 
                MKLmsg = paste0("Multithreaded BLAS/LAPACK libraries detected. Using ", ncores, " cores for math algorithms.\n")
            } 
        } else {
            if (load_if_installed("RevoUtilsMath")) {
                ncores <- RevoUtilsMath::getMKLthreads()
                MKLmsg = ""
            } else {
                MROversion <- paste(Revo.version$major, Revo.version$minor, sep=".")
                MKLmsg <- "No performance acceleration libraries were detected. To take advantage of \nthe available processing power, also install MKL for R Open. \n\nVisit http://go.microsoft.com/fwlink/?LinkID=698301 for more details."
            }      
        }
    } else {
        ncores <- RevoUtilsMath::getMKLthreads()
        MKLmsg <- ""
    }

    quiet <- any(match(c("-q", "--silent", "--quiet", "--slave"), commandArgs()), na.rm=TRUE)
    if (!quiet && !identical(system.file(package="RevoScaleR") , "")) {
        cat("Microsoft R Open ",R.version$major,".",R.version$minor,"\n",sep="")
        cat("The enhanced R distribution from Microsoft\n",sep="")
        cat("Microsoft packages Copyright (C)", Revo.version$year, "Microsoft\n\n")
        if (MRS.is.client == FALSE) {
           ScaleRPkgName <- "RevoScaleR"
           pkgVersion <- utils::packageDescription(ScaleRPkgName)$Version
           cat("Loading Microsoft R Server packages, version ", pkgVersion,".\n", sep = "")
        } else {
           RclientPkgName <- "MicrosoftR"
           pkgVersion <- utils::packageDescription(RclientPkgName)$Version
           cat("Loading Microsoft R Client packages, version ", pkgVersion,". \n", sep = "")
           cat("Microsoft R Client limits some functions to available memory.\n") 
           cat("See: https://msdn.microsoft.com/en-us/microsoft-r-client-windows for information\n",sep="")
           cat("about additional features.\n\n",sep="")
        }   
        cat("Type 'readme()' for release notes, privacy() for privacy policy, or\n", sep = "")
        cat("'RevoLicense()' for licensing information.\n\n", sep = "")
        if (MKLmsg == "") {
           cat(paste("Using the Intel MKL for parallel mathematical computing(using", ncores, "cores).\n", sep = " "))
        } else {
           cat(MKLmsg, MROversion, sep = " ")
        }
        cat(paste("Default CRAN mirror snapshot taken on ",repos.date, ".\n",sep=""))
        cat("See: https://mran.microsoft.com/.", "\n\n", sep = "")
        mrupdate::mrCheckForUpdates()
    } else if (!quiet) {
        cat("Microsoft R Open ",R.version$major,".",R.version$minor,"\n",sep="")
        cat("The enhanced R distribution from Microsoft\n",sep="")
        cat("Microsoft packages Copyright (C)", Revo.version$year, "Microsoft Corporation\n\n")
        if (MKLmsg == "") {
           cat(paste("Using the Intel MKL for parallel mathematical computing(using", ncores, "cores).\n", sep = " "))
        } else {
           cat(MKLmsg)
        }
        cat("\nDefault CRAN mirror snapshot taken on ",repos.date, ".", sep = "")
        cat("\n", "See: https://mran.microsoft.com/.",sep="")
        cat("\n\n")
    }   
}
)   
Javdat commented 6 years ago

Seems to be XQuartz issue, so closing it here.