Hi, I have difficulties getting Julia and R working together. Specifically, the Julia library RCall does not recognize R packages. Here is my
shell.nix
# shell.nix
with import <nixpkgs> {};
pkgs.mkShell {
buildInputs = [
(pkgs.rWrapper.override {
packages = with pkgs.rPackages; [
sf
]; # Include sf inside Nix
})
R
julia-lts
curl
gdal
proj
sqlite
geos
];
NIX_LD_LIBRARY_PATH = lib.makeLibraryPath [
gcc # ...
gfortran
stdenv
openspecfun
curl
proj
sqlite
geos
libssh2
];
NIX_LD = lib.fileContents "${stdenv.cc}/nix-support/dynamic-linker";
shellHook = ''
# Set R_LIBS_USER to an empty value to avoid unwanted user-specific libraries
export R_LIBS_USER=""
export R_LIBS_SITE=$(R RHOME)/library
export R_HOME=$(R RHOME)
'';
}
Then
nix-shell --pure
and in Julia
using Pkg; Pkg.build("RCall"); using RCall
However, I get
julia> using RCall
┌ Warning: RCall.jl: During startup - Warning messages:
│ 1: package "methods" in options("defaultPackages") was not found
│ 2: package 'utils' in options("defaultPackages") was not found
│ 3: package 'grDevices' in options("defaultPackages") was not found
│ 4: package 'graphics' in options("defaultPackages") was not found
│ 5: package 'stats' in options("defaultPackages") was not found
│ 6: package 'methods' in options("defaultPackages") was not found