Thursday, September 7, 2017

Installing and configuring rpy2 on Windows using Intellij

This is going to be a quick one. If you need to install rpy2 on Windows there are a few tips I thought I might share:
How do I install all this on my machine?
  • Install
    • R 3.3
    • Anaconda2 (with python 2.7)
  • Add to Path:
    • C:\Program Files\R\R-3.3.3\bin
    • <Anaconda2 folder>
    • <Anaconda2 folder>\Scripts
    • <Anaconda2 folder>\Library\bin
  • In your <Anaconda2 folder> run as administrator: "conda install -c r rpy2=2.8.5"
  • Validate python packages installed in anaconda python:  (In Intellij using alt+enter on the missing import)
    • numpy
    • pandas
    • rpy2
    • etc.
  • Validate existing env variables:
    • R_HOME = C:\Program Files\R\R-3.3.3
    • R_User = <Anaconda2 folder>\Lib\site-packages\rpy2
  • Navigate to R_HOME location and run R ("r" in cmd) to install the following libraries (install.packages("<library>"):
    • >install.packages("zoo")
    • >install.packages("timeDate")
    • >install.packages("forecast")
    • >install.packages("xts")
  • Open the code in Intellij and configure the Intellij python interpreter to <Anaconda2 folder>\python.exe

No comments:

Post a Comment