Using Rmd Markdown in Pelican

R
Python
A definitive setup for OSX.
Author

Mauricio “Pachá” Vargas S.

Published

December 25, 2015

Updated 2022-05-28: Updated links.

My notebook is dead until I buy a new battery. Now I’m using a lent MacBook Pro for urgent work and I had to install R, RStudio and Stata. After doing the basics I’ve realised a lot of things weren’t working as they were on my laptop.

This blog is based on Pelican. Among other R’s useful packages, I use XLConnect, knitr and rmarkdown that were easy to install without problems and only required Java updates and installing some dependencies from R prompt. The problem came with many errors when I tried to finish a blog entry after writing pelican content in terminal:

#Starting point These readings were really useful and after I did follow all the steps here I was still obtaining errors. It is very important to follow these steps before reading the rest of this entry.

#Setting up everything The above pages are really clear but I needed to work out a little bit more to obtain an error-free result.

##First error

ValueError: unknown locale: UTF-8

To solve this part I did follow stackoverflow, but I had to create my own solution which was adding two lines to my .bash_profile file:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

##Second error Then I tried to finish a blog entry and the results were lots of these after writing pelican content in terminal:

ERROR: Could not process ./file.Rmd
  | TypeError: (u'Pelican does not know how to parse %s', u'/Users/pacha/pachadotdev.github.io/blog/content/file.Rmd')

I had to install stock Python (not OSX pre-installed Python) using homebrew as it is stated in stackoverflow

After installing homebrew I did run these lines in terminal:

sudo -H pip uninstall pelican
brew install python
which python # should show /usr/local/bin/python
python -V # Python 2.7.11 in my case
pip install pelican

Then I did restart my computer and Pelican worked fine.