Skip to content
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

Warning messages are not handled correctly #40

Open
nlewo opened this issue Oct 12, 2018 · 6 comments
Open

Warning messages are not handled correctly #40

nlewo opened this issue Oct 12, 2018 · 6 comments

Comments

@nlewo
Copy link

nlewo commented Oct 12, 2018

With the latest release, when loading a library that return warning messages, the kernel fails.

In []: require(RDatalake)
Loading required package: RDatalake
Error in if (w$call != "eval(parse(text = code), envir = .GlobalEnv)") message(w,  : 
  argument is of length zero
Calls: <Anonymous> ... doTryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>

This library can be loaded in the R interpreter:

> require(RDatalake)
Loading required package: RDatalake
Warning messages:
1: replacing previous import ‘dplyr::sql’ by ‘dbplyr::sql’ when loading ‘RDatalake’ 
2: replacing previous import ‘dplyr::ident’ by ‘dbplyr::ident’ when loading ‘RDatalake’ 
> 

It is possible to load this library in the kernel if warning messages are ignored:

in []: suppressWarnings(require(RDatalake))
Loading required package: RDatalake

With the release 1.2.3.0, the library can be loaded. So, it seems this regression has been introduced by the commit 00c4d73.

I can try patches if needed.
Thanks.

cc @spennihana

@spennihana
Copy link
Member

Hiya,

A patch here would be most welcome! I would want to make sure we don't regress #24, so let me push a test to inst/runits for that.

By the way, can you create a reproducible example? It appears that RDataLake may be your custom package.

@spennihana
Copy link
Member

@spennihana
Copy link
Member

@nlewo is this still a problem for you? I would like to resolve this issue.

@idontgetoutmuch
Copy link

I am experiencing this problem when using the package rstan.

@idontgetoutmuch
Copy link

@nlewo I tried copying what you did but get

installing via 'install.libs.R' to /nix/store/yggpnwrsawhx5qajafwjydzj4hih3cjv-r-JupiterKernel/library/00LOCK-JuniperKernel/00new/JuniperKernel
sh: which: command not found
Error in system("which install_name_tool", intern = TRUE) :
  error in running command
* removing '/nix/store/yggpnwrsawhx5qajafwjydzj4hih3cjv-r-JupiterKernel/library/JuniperKernel'
builder for '/nix/store/da72h8j1afm8wi1430fvl3hm02x0sxyr-r-JupiterKernel.drv' failed with exit code 1
cannot build derivation '/nix/store/lc29rgz92bhcrsysaz1fb7wvkhqzf8bp-R-3.6.1-wrapper.drv': 1 dependencies couldn't be built
error: build of '/nix/store/6c7vajxk7irrk7jlijd8znaazi8kga2w-jupyter-R-kernel.drv', '/nix/store/lc29rgz92bhcrsysaz1fb7wvkhqzf8bp-R-3.6.1-wrapper.drv' failed
let
pkgs = import <nixpkgs> {};
in

let

fontsConf = pkgs.makeFontsConf { fontDirectories = [ ];  };

my-R-packages = with pkgs.rPackages; [ rstan zoo ggplot2 dplyr coda ];

buildRPackage =
    pkgs.callPackage "${pkgs.path}/pkgs/development/r-modules/generic-builder.nix"
    { Cocoa = null; Foundation = null; };

JuniperKernel_1_2_3_0 = buildRPackage {
    name = "JupiterKernel";
    src = pkgs.fetchurl {
      url = https://cran.r-project.org/src/contrib/Archive/JuniperKernel/JuniperKernel_1.2.3.0.tar.gz;
      sha256 = "17r4ssjjayvnp9fp9jalklp3p8dadyx5hvi9z3bh3sw4b7kx4lyd";
    };
    preConfigure = ''
        patchShebangs configure
      '';
    requireX = false;
    propagatedBuildInputs = with pkgs.rPackages; [ data_table gdtools jsonlite pbdZMQ Rcpp repr ];
    nativeBuildInputs = with pkgs.rPackages; [ data_table gdtools jsonlite pbdZMQ Rcpp repr ];
  };

R-with-my-packages = pkgs.rWrapper.override{ packages = with pkgs.rPackages; my-R-packages ++ [ JuniperKernel_1_2_3_0 ]; };

jupyter-R-kernel = pkgs.stdenv.mkDerivation {
  name = "jupyter-R-kernel";
  buildInputs = [ pkgs.python36Packages.notebook R-with-my-packages pkgs.which ];
  unpackPhase = ":";
  installPhase = ''
    export HOME=$TMP
    echo $JUPYTER_PATH
    ${R-with-my-packages}/bin/R --slave -e "JuniperKernel::listKernels()"
    ${R-with-my-packages}/bin/R --slave -e "JuniperKernel::installJuniper(prefix='$out')"
  '';
};
in
pkgs.mkShell rec {
  name = "jupyter-with-R-kernel";
  buildInputs = [ pkgs.libintl jupyter-R-kernel pkgs.python36Packages.jupyter pkgs.which ];
  shellHook = ''
    export FONTCONFIG_FILE=${fontsConf}
    # Fontconfig error: Cannot load default config file
    export JUPYTER_PATH=${jupyter-R-kernel}/share/jupyter
    # see https://github.com/NixOS/nixpkgs/issues/38733
    ${R-with-my-packages}/bin/R --slave -e "system2('jupyter', 'notebook')"
  '';
}

@idontgetoutmuch
Copy link

@nlewo I needed buildInputs = [ pkgs.which pkgs.R pkgs.libintl ]; and now all is well using the old version of JuniperKernel. Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants