JuliaInterop / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
267 stars 36 forks source link

Troubleshooting suggestion #169

Open wjholden opened 3 years ago

wjholden commented 3 years ago

I encountered a two-part problem that I was able to resolve myself. My problem looked like this:

> devtools::install_github("Non-Contradiction/JuliaCall")
Skipping install of 'JuliaCall' from a github remote, the SHA1 (2c438e37) has not changed since last install.
  Use `force = TRUE` to force installation
> library(JuliaCall)
> julia <- julia_setup()
Julia version 1.6.1 at location C:\Users\wjhol\AppData\Local\Programs\JULIA-~1.1\bin will be used.
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Users/wjhol/AppData/Local/Programs/JULIA-~1.1/bin/libjulia.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

Error in juliacall_initialize(.julia$dll_file, .julia$bin_dir, img_abs_path) : 
  C:\Users\wjhol\AppData\Local\Programs\JULIA-~1.1\bin\libjulia.dll - %1 is not a valid Win32 application.

I have used JuliaCall on this computer for a while, but not recently. I think I had recently updated R to 4.1.0. My solution to this problem was twofold:

  1. Updates to the R language can break the RCall package in Julia. Try running using RCall in Julia. If you get an error, then try using Pkg; Pkg.build("RCall").
  2. If JuliaCall works in your terminal but not RStudio, this could be because RStudio is using a 32-bit R interpreter. Use the version command in R to find out. I solved this problem by reinstalling the R language with only the 64-bit executable.
wjholden commented 2 years ago

Another troubleshooting suggestion: make absolutely sure you do not have two different versions of R installed.

wjholden commented 1 year ago

Yet another tip for anyone struggling: if you've uninstalled an old version of R while a Julia session has been open in PowerShell, the $env:PATH variable might be out-of-date. It might help to close the terminal and re-open it.