johnmchambers / XRJulia

XR-style Interface to Julia (from "Extending R")
33 stars 2 forks source link

XRJulia's `juliaEVal` doesn't seem to work on Windows #8

Closed xiaodaigh closed 5 years ago

xiaodaigh commented 6 years ago
library(XRJulia)
findJulia(test = TRUE)

The above works fine and returns the path to Julia.

When I run the below it just hangs and doesn't return.

regjl <- juliaEval("
  function reg(x,y)
    n=size(x,1)
    xreg=hcat(ones(size(x)[1],1),x)
    k=size(xreg,2)
    p1=((xreg'xreg)^(-1))
    b=p1*xreg'y
    r=y-xreg*b
    sig=(r'r)/(n-k)
    vmat=sig[1]*p1
    sigb=sqrt(diag(vmat))
    t=b./sigb

    return (b,t)
  end
")

Below is my session info and I am using JuliaPro 0.6.0.1

R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252 
[2] LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252
[4] LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics 
[3] grDevices utils    
[5] datasets  methods  
[7] base     

other attached packages:
[1] XRJulia_0.7         
[2] RevoUtilsMath_10.0.0
[3] RevoUtils_10.0.5    
[4] RevoMods_11.0.0     
[5] MicrosoftML_1.5.0   
[6] mrsdeploy_1.1.2     
[7] RevoScaleR_9.2.1    
[8] lattice_0.20-35     
[9] rpart_4.1-11        

loaded via a namespace (and not attached):
 [1] codetools_0.2-15      
 [2] CompatibilityAPI_1.1.0
 [3] foreach_1.4.4         
 [4] grid_3.4.1            
 [5] R6_2.2.0              
 [6] jsonlite_1.4          
 [7] curl_2.6              
 [8] iterators_1.0.8       
 [9] tools_3.4.1           
[10] yaml_2.1.14           
[11] compiler_3.4.1        
[12] XR_0.7                
[13] mrupdate_1.0.1       
johnmchambers commented 6 years ago

I don't have access to a Windows version, and your example "works" on Mac OS.

The example is unlikely to be what you wanted to do, since it only defines a function in Julia without giving you any R proxy function to call it. Is that really what you tested?

Testing your example by juliaEval("%s(%s,%s)", regjl, x, y,.get=TRUE) where x and y were R numeric vectors returned something at least of a reasonable structure.

Without further information, I'll close this after a while.

vh-d commented 6 years ago

xiaodaigh, can you try juliaEval("1+1") and wait at least 1 minute to test the connection between Julia and R?

Are you running RStudio or plain R?

xiaodaigh commented 6 years ago

Try the below in Rstudio. The code just hangs there in the REPL and doesn't return anything. Also findJulia(test =TRUE) returns true.

library(XRJulia)
findJulia(test = TRUE)
juliaEval("2+2")
vh-d commented 6 years ago

I can't reproduce this behavior on XRJulia 0.76 / R 3.4.3 / RStudio 1.1.393 / Julia 0.6.1 / Windows 7 64-bit

Are you behind some kind of firewall or antivirus that may be blocking socket connections between processes?

You can try

library(XRJulia)
RJulia(verbose = TRUE)

Unfortunately, there is a bug in RStudio for Windows which causes you don't see std. output / error messages of processes started by system() or system2() in RStudio console (I reported it months ago). So if you get some error messages from Julia, you can't see it.

xiaodaigh commented 6 years ago

Ok. I tested it again on home computer it works.

On work computer it's got enterpise virus scans and firewall so am not sure how to diagnose that? Hopefully I can try with RJulia(verbose = T) and see how things go.

On Wed, Dec 20, 2017 at 8:59 PM, Václav Hausenblas <notifications@github.com

wrote:

I can't reproduce this behavior on XRJulia 0.76 / R 3.4.3 / RStudio 1.1.393 / Julia 0.6.1 / Windows 7 64-bit

Are you behind some kind of firewall or antivirus that may be blocking socket connections between processes?

You can try

library(XRJulia) RJulia(verbose = TRUE)

Unfortunately, there is a bug in RStudio for Windows which causes you don't see std. output / error messages of processes started by system() or system2() in RStudio console (I reported it months ago). So if you get some error messages from Julia, you can't see it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johnmchambers/XRJulia/issues/8#issuecomment-353019142, or mute the thread https://github.com/notifications/unsubscribe-auth/AESfJWp3mAh7ZrP4cdYGZo2vna1nJFT1ks5tCNp8gaJpZM4RCtQt .

-- ZJ

zhuojia.dai@gmail.com

xiaodaigh commented 5 years ago

It works on the computer at work now. Closing the issues!