-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue building RCall on Windows 8 #52
Comments
@tkelman Do you have any suggestions for what we could try here? |
Not an R user, so not really. Try looking at the R dll in Dependency Walker to see if there's anything obviously missing. And try |
Based on your suggestions and after some debugging, I figured it would be best if I installed R in the C:\ folder instead of in "Program Files". I also changed the corresponding environment variables. After making the changes, I was able to Pkg.build("RCall") properly. The deps/deps.jl file after being written out looked like this- # This is an auto-generated file; do not edit
const libR="C:\\R-2.15.3\bin\x64\R.dll"
ENV["R_HOME"]="C:\\R-2.15.3"
ENV["R_DOC_DIR"]="C:\\R-2.15.3\\doc"
ENV["R_INCLUDE_DIR"]="C:\\R-2.15.3\\include"
ENV["R_SHARE_DIR"]="C:\\R-2.15.3\\share"
ENV["LD_LIBRARY_PATH"]="C:\\R-2.15.3" Notice that libR is not set properly. I changed it to const libR="C:\\R-2.15.3\\bin\\x64\\R.dll" I closed the julia session, opened it again and did- julia> using RCall
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/R-2.15.3/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
During startup - Warning message:
package 'stats' in options("defaultPackages") was not found I tried dlopen'ing it manually- julia> cd("C:/R-2.15.3/library/stats/libs/x64")
shell> ls
stats.dll
julia> dlopen("stats.dll")
ERROR: could not load module stats.dll: The specified module could not be found.
in dlopen at c.jl:19 So this is where I am stuck. The stats.dll file exists but I am not able to load it. I tried both the i386 and x64 versions of stats.dll and could not load either. Am I supposed to be able to load stats.dll file with dlopen just like I could for R.dll? |
I don't think you should have to load Searching for |
What happens if you simply do: const libR="C:\\R-2.15.3\bin\x64\R.dll"
argv = ["REmbeddedJulia","--silent","--no-save"]
ccall((:Rf_initEmbeddedR,libR),Cint,(Cint,Ptr{Ptr{Uint8}}),length(argv),argv) ? |
Ok. We might have made some progress. I was able to get RCall working under cygwin with some modifications. But I was not able to get it work in the default windows shell, i.e. directly running julia.exe by double clicking. So it appears that the core problem is probably to do with Windows/Unix paths. Here is my setup from scratch to get it to work in cygwin so others can replicate it-
R_HOME = "C:\\R-3.2.0"
R_DOC_DIR = "C:\\R-3.2.0\\doc"
R_INCLUDE_DIR = "C:\\R-3.2.0\\include"
R_SHARE_DIR = "C:\\R-3.2.0\\share"
LD_LIBRARY_PATH = "C:\\R-3.2.0"
# Original
const libR = joinpath(ENV["R_HOME"],"lib",string("libR.",BinDeps.shlib_ext))
# Modified
const libR = joinpath(ENV["R_HOME"],"bin","x64",string("R.",BinDeps.shlib_ext))
julia> Pkg.build("RCall")
INFO: Building RCall
julia> using RCall
Warning: error initializing module RCall:
ErrorException("error compiling __init__: could not load module C:\R-3.2.indR.dll: The specified module could not be found.")
# Original
const libR="C:\\R-3.2.0\bin\x64\R.dll"
# Modified
const libR="C:\\R-3.2.0\\bin\\x64\\R.dll"
But I was not able to get the same setup running julia outside of cygwin-
julia> using RCall
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/R-3.2.0/library/stats/libs/x64/stats.dll':
LoadLibrary failure: The specified module could not be found.
During startup - Warning message:
package 'stats' in options("defaultPackages") was not found
If anyone has suggestions on getting it working in the plain windows terminal, I will be happy to test it out. |
More progress. Looking at the article that @simonbyrne sent [https://rdotnet.codeplex.com/discussions/444463], I made the following changes to the Windows Path variable- # Original
PATH=<blah>;C:\R-3.2.0\bin
# Modified
PATH=<blah>;C:\R-3.2.0\bin\x64;C:\R-3.2.0\bin This fixed the issue. I am now able to run in the default windows terminal without issues. |
Thats's interesting. It would be nice if we could do this without the user needing to modify their PATH variable. Does it work if you instead modify the PATH from within julia? say by ENV["PATH"] *= ";C:\\R-3.2.0\\bin\\x64;C:\\R-3.2.0\\bin" before |
You could also try appending to |
Actually, when I removed the earlier added entry, it worked!
So when I do not have R in my path, it worked. No need to add anything to path. I think the R_* environment variables take care of things. Final suggestions for helping easy installing for Windows-
Thanks. |
I've pushed a patch to master, which I think should fix it: would you be able to try it out? If it's all okay, I can then tag a new release. |
Hi Simon, I started from a fresh install of Julia (renamed the .julia directory) and tried to install RCall keeping the R_* environment variables intact. I am getting the following error-
I think this has to do with trying to call C:\R-3.2.0\lib\libR.dll. For Windows, the deps.jl needs to be modified to something like-
for 64 bit installation of R. Thanks. |
@skrisna Sorry I should have said that you need to check out the master branch. Try: Pkg.checkout("RCall","master")
Pkg.build("RCall")
using RCall
... Once you're done, you can set it back with |
I had to do two things to get it to work (probably should be documented)
My current settings for the two environment variables are -
The problem has been successfully resolved. Please close the ticket (or should I do it?) when ever you thick fit. |
Hmm. It would be nice if we could do without users having to manually change their environmental variables. Does this:
work on Windows? |
With my current setup as described in the previous emails, windows reported that it could not find Rscript (both in command line and within julia). It turns out that Rscript.exe is present in both the <R_HOME>\bin and <R_HOME>\bin\x64 locations and the one in <R_HOME>\bin does not work. Since my PATH was setup as ";;C:\R-3.2.0\bin;C:\R-3.2.0\bin\x64", the wrong Rscript.exe was getting picked up. So I had to remove "<R_HOME>\bin" from my path and retain "<R_HOME>\bin\x64". With this change, I was able to get the command to execute--
But this, I figured was probably because I had already setup these environment variables. When I remove dthe R_* environment variables as well as LD_LIBRARY_PATH, I got this from both within R and julia-
It it was only able to automatically infer R_HOME and R_ARCH. |
I think I've come up with a reasonable solution: R stores its installation path in the Windows Registry, which we can query using I'll have another look at it over the weekend. |
Modify build steps, in particular fixes building on Windows (#52).
@skrisna Having managed to get my hands on a Windows VM, and learning more than I cared about Windows environmental variables, I think I have a fairly reasonable solution that doesn't require the user to modify their PATH. Could you please try
again, and let me know how it goes? |
@simonbyrne Sorry for the delayed response. I finally got a chance to test out your changes. But ran into a problem-
I have not seen this problem earlier. For this test, I removed all my R_* environment variables as well as removed R from my Windows path. Let me know if I should have some of the environment variables set. I am using a slightly dated version of Julia (0.3.7). |
Hmm, I have no idea what is happening there. Any chance you could try 0.3.8? (or does anyone know where I can download 0.3.7?) |
Let me install 0.3.8. |
I am getting the same problem on 0.3.8. Also, when I tried the 0.4.0-dev+4825 (2015-05-14), starting from a completely fresh install, I get--
So it works without issues in 0.4.0-dev but not in 0.3.8. My setup is clean as far as environment variables and path go (registry ofcourse has R entries). |
I looked at the RCall\src\types.jl file @ line 247 and see this-
Not sure if that gives you some ideas. Thanks. |
This appears to be a problem with Docile.jl. If you |
Thanks again for all your patience with this, it's really great to have this working. |
Okay, I've tagged a new release. You can get back to releases from the master branch via |
@simonbyrne I tested RCall on 0.3.8 after pinning Docile and it worked. How do I unpin Docile? No problem. I learnt a lot about julia during this time. |
Same: |
@simonbyrne This is what I am getting-
Also, this-
|
@simonbyrne Please ignore my last comment. I am all set. |
Great. Docile has now been updated, so a |
I am trying to get RCall working for Win8/x64. I am working with the latest 0.3.7/x64 version of Julia for Windows. I first manually added the required environment variables as follows-
R_DOC_DIR = C:/PROGRA
1/R/R-321.0/doc [Full path: C:\Program Files\R\R-3.2.0\doc]R_HOME = C:/PROGRA
1/R/R-321.0 [Full path: C:\Program Files\R\R-3.2.0]R_INCLUDE_DIR = C:/PROGRA
1/R/R-321.0/include [Full path: C:\Program Files\R\R-3.2.0\include]R_SHARE_DIR = C:/PROGRA
1/R/R-321.0/share [Full path: C:\Program Files\R\R-3.2.0\share]LD_LIBRARY_PATH = C:/PROGRA
1/R/R-321.0/modules/x64 [Full path: C:\Program Files\R\R-3.2.0\modules\x64]In going through deps/build.jl, I noticed that it was trying to access [joinpath(ENV["R_HOME"],"lib",string("libR.",BinDeps.shlib_ext))] which expands to [ C:/PROGRA
1/R/R-321.0/lib/libR.dll] but this file does not exist on Windows install of R. So I created this "lib" in C:/PROGRA1/R/R-321.0 and placed the dll "R.dll" from [C:\Program Files\R\R-3.2.0\bin\x64] in the lib directory. I renamed R.dll to libR.dll. This did not help. I get the error message-- QUOTE --
================================[ ERROR: RCall ]================================
Unable to load C:/PROGRA
1/R/R-321.0/lib/libR.dllPlease re-run Pkg.build(package), and restart Julia.
while loading C:\Users\Krishna.julia\v0.3\RCall\deps\build.jl, in expression st
arting on line 14
-- UNQUOTE --
Just for good measure, I copied over all the other dlls found in C:\Program Files\R\R-3.2.0\bin\x64 over to the "lib" folder but that did not help either.
If anyone has got a working Windows version of Rcall working, kindly share your setup.
Thanks.
The text was updated successfully, but these errors were encountered: