Install R, Python and Pelican Blog Tool on Windows

Updated 2018-03-26

Motivation

On a previous post I explained how to install R and Python effortlessy on IS X.

Now I bought a Windows machine and this post concentrates a lot of reading and the experiments I made until I configures everything in order to write this blog post. I use Pelican for my blog, so I had to do a few steps I wasn’t aware of in Windows.

What do you need to do this?

You’ll need Chocolatey installed and administrator access to Windows PowerShell. In this way an important part of path-related issues are solved.

Install R and Python

This part is easy. From PowerShell run:

choco install r.project python2

Install RStudio and GitHub Desktop

I just downloaded the graphic installers and this part this not need additional configurations.

Install Rtools

If you want to build a package, RStudio will warn you that it cannot find Rtools and will ask you to download it. This part is all about clicking “yes” and RStudio will set up everything.

Install R packages

If all of the above steps went well, you can open RStudio and run this:

# common use packages
install.packages(c("tidyverse","data.table","dtplyr","knitr","devtools"))

# things I use for lectures/work
library(devtools)
devtools::install_github("ropenscilabs/skimr")
install.packages(c("sjlabelled","np","bbmle","micEcon","HistData","XLConnect"))

Install Pelican, Markdown and rpy2

MathJax plugin presents problems with newer Pelican versions, so I’ll use Pelican 3.6.3 as in my post for OS X.

Run this from PowerShell:

pip install pelican==3.6.3 markdown

Before installing rpy2 you need to edit the system PATH. Go to the Control Panel and add this to the Path:

%ProgramFiles%\R\R-3.4.1\bin\x64

Then create the following variables:

R_HOME pointing to %ProgramFiles%\R\R-3.4.1
R_LIBS_USER pointing to %userprofile%\documents\R\win-library\3.4
R_USER containing your username

The easiest option to install rpy2 is to install it using UC Irvine’s I got the version for Python 2.7 and then I did run:

pip install C:\Users\pacha\Downloads\rpy2-2.7.8-cp27-none-win_amd64.whl

And finally I was able to write blog entries without errors or warning on Windows!