tweag / HaskellR

The full power of R in Haskell.
https://tweag.github.io/HaskellR
Other
585 stars 47 forks source link

HaskellR: install R packages from github? #291

Closed skeydan closed 7 years ago

skeydan commented 7 years ago

Hi,

is there a way to integrate R packages into HaskellR (using nix) that are not available on CRAN? (My current hypothesis is that packages installed via shell.nix must be available on CRAN.)

(In R directly, I'd use install_github from devtools.)

Thank you very much, Sigrid

Fuuzetsu commented 7 years ago

Hi,

There is nothing special about CRAN packages. The default nix repository, nixpkgs, uses CRAN and few other mirrors because it has scripts to generate packages from. Basically you want to package your R package with nix, override the R package set that nix uses by default and just put your package in dependencies as with any other one. There are a few options:

a) ask how to do that on NixOS/nixpkgs repository or in #nixos IRC on Freenode b) let me know what package from GitHub you are looking to package and I can give it a go.

The problem with b) is that I suspect it will be followed with a "how to integrate it into my setup?" questions and it will become a back-and-forth ping-pong.

Briefly: yes HaskellR will work with any dependency you can package with nix. This is not the best place to learn about using nix. I can try to help you out but fear how long that may take.

Fuuzetsu commented 7 years ago

I want to make clear that I'm okay with trying b)! Let me know what package/sample GitHub package you're after and I can give it a shot then post what I found out here. If you can include your current setup (how you're using CRAN packages) that would be very helpful as perhaps I can come up with a very similar approach.

skeydan commented 7 years ago

Hi, thanks a lot for your offer (and response!). Truth is, perhaps the problem with b) as you see it may be realistic ;-) I was thinking of installing keras (recently released by rstudio, as opposed to kerasR, which is avaialble on CRAN) - but then I'll immediately run into issue 292 (another one I opened), namely, how to get keras to work with the TensorFlow backend... Perhaps it's better I close the issues and don't waste your time :-) It's not required I use keras with HaskellR, it was just an idea :-) Perhaps anyway it's an idea that wouldn't make much sense to people anyway, as for deep learning in Haskell you'd probably just use the TensorFlow bindings...

Just to answer your question anyway, the way I was using packages from CRAN was by adding them to shell.nix:

buildInputs = [ ncurses python35Packages.ipython python35Packages.jupyter_client python35Packages.notebook R rPackages.ggplot2 rPackages.rjson
rPackages.forecast rPackages.kerasR zeromq zlib ];

Thanks again Sigrid

skeydan commented 7 years ago

This is handled by #292 - thank you!