diff --git a/bin/compile b/bin/compile
index 27c43d59655756cf7539d1c73e395e03b37d0b5c..fd8edc3fb09795e56df52a220bf7d1dcb0786bcb 100755
--- a/bin/compile
+++ b/bin/compile
@@ -113,6 +113,10 @@ except:
 EOF
 fi
 
+if (grep -Fiq "hg+" requirements.txt) then
+  PIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE bin/pip install --use-mirrors mercurial | indent
+fi
+
 echo "-----> Installing dependencies using pip version $(bin/pip --version | awk '{print $2}')"
 PIP_DOWNLOAD_CACHE=$PIP_DOWNLOAD_CACHE bin/pip install --use-mirrors -r requirements.txt | indent