# R packages in 'install.R' fail to load - MRAN down?

**URL:** <https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350>\
**Category:** Binder\
**Created:** [February 17, 2020, 12:09pm UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350 "2020-02-17T12:09:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ambujtewari](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/ambujtewari/32/1578_2.png) [@ambujtewari](https://discourse.jupyter.org/u/ambujtewari)\
**Post date:** [February 17, 2020, 12:09pm UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350/1 "2020-02-17T12:09:25Z")

</div>

Hi there,

I have this git repo for an R project:

> **[ambujtewari/stats306-winter2020](https://github.com/ambujtewari/stats306-winter2020/)**
>
> Material for STATS 306 (Winter 2020) course at University of Michigan - ambujtewari/stats306-winter2020

I am using a combination of ‘runtime.txt’ and ‘install.R’ to set up my configuration. It used to work just fine until a couple of days ago. Now, the binder runs but the packages (e.g., “tidyverse”) specified in ‘install.R’ fail to load. Examining the build logs suggests that the problem occurs because MRAN is down. E.g., the following URL:

[https://mran.microsoft.com/snapshot/2020-02-01/src/contrib/](https://mran.microsoft.com/snapshot/2020-02-01/src/contrib/)

returns the error message “The specified CGI application encountered an error and the server terminated the process.”

I was wondering if anyone else has faced this issue. Are there any workarounds for this?

Thanks!

---

<div class="post-metadata">

**Author:** ![manics](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/manics/32/85_2.png) [@manics](https://discourse.jupyter.org/u/manics)\
**Post date:** [February 17, 2020, 3:24pm UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350/2 "2020-02-17T15:24:57Z")

</div>

Welcome to the forum!  
Unfortunately this is a recurring issue with MRAN ☹. You can see some discussion on

> <https://github.com/jupyter/repo2docker/issues/773>
>
> Proposed change
> Provide an alternative way of pinning R packages to using MRAN dates. MRAN has been flaky/unavailable several times this week...

  
but no-one’s yet come up with a good solution.

---

<div class="post-metadata">

**Author:** ![ambujtewari](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/ambujtewari/32/1578_2.png) [@ambujtewari](https://discourse.jupyter.org/u/ambujtewari)\
**Post date:** [February 17, 2020, 4:50pm UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350/3 "2020-02-17T16:50:00Z")

</div>

Thanks a lot @manics! Even though there is no good solution to this MRAN issue, it is still useful to learn that this issue isn’t specific to me.

---

<div class="post-metadata">

**Author:** ![betatim](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/betatim/32/10_2.png) [@betatim](https://discourse.jupyter.org/u/betatim)\
**Post date:** [February 18, 2020, 7:00am UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350/4 "2020-02-18T07:00:58Z")

</div>

We recently added a new way to install R packages and RStudio to repo2docker (the tool doing the image building). It uses conda-forge instead of MRAN. Might be worth trying out while MRAN is unavailable.

An example on how to do this is in [https://github.com/betatim/r-conda](https://github.com/betatim/r-conda). The basic pattern is to take the R package name and add a `r-` to the beginning, then add it to `environment.yml`.

This should speed up building your repository on [mybinder.org](http://mybinder.org) because the conda packages don’t need compiling. Right now installing tidyverse from MRAN takes an hour or so because we have to compile lots of things.

Another side benefit could be that the conda package mirror has better uptime than MRAN.

A downside of this approach could be that not all the packages you need are available on conda-forge. For this we need more people using this approach to get some feeling for how good/bad the coverage is.

It would be great if you have a moment to try this out and send feedback/an experience report 🙂

---

<div class="post-metadata">

**Author:** ![ambujtewari](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/ambujtewari/32/1578_2.png) [@ambujtewari](https://discourse.jupyter.org/u/ambujtewari)\
**Post date:** [February 19, 2020, 2:41pm UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350/5 "2020-02-19T14:41:55Z")

</div>

Thanks you @betatim for the suggestion to use conda-forge instead of MRAN. MRAN is back for now. But I will give your suggestion a try and report back my experience.

---

<div class="post-metadata">

**Author:** ![carlos\_siri](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/carlos_siri/32/1719_2.png) [@carlos\_siri](https://discourse.jupyter.org/u/carlos_siri)\
**Post date:** [March 16, 2020, 3:46am UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350/6 "2020-03-16T03:46:43Z")

</div>

It seems that MRAN is still down. I tried your suggestion and it works.  
Now, why MRAN still seems to be an option if it is constantly down, should we just stick to conda-forge?

---

<div class="post-metadata">

**Author:** ![ambujtewari](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/ambujtewari/32/1578_2.png) [@ambujtewari](https://discourse.jupyter.org/u/ambujtewari)\
**Post date:** [March 19, 2020, 11:27pm UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350/7 "2020-03-19T23:27:09Z")

</div>

I tried the conda-forge approach and it works like a charm! Thanks @betatim!

The only (small) issue was that the package `dslabs` was not found. On CRAN, it appeared on 13 December 2019. So it is a very new package. I had no problems whatsoever with older, stable packages.

---

<div class="post-metadata">

**Author:** ![betatim](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/betatim/32/10_2.png) [@betatim](https://discourse.jupyter.org/u/betatim)\
**Post date:** [March 20, 2020, 8:05am UTC](https://discourse.jupyter.org/t/r-packages-in-install-r-fail-to-load-mran-down/3350/8 "2020-03-20T08:05:17Z")

</div>

Glad to hear that it worked well 🙂

Not every R package is on conda-forge yet. However it should not be super difficult to add a new one and everyone can do it (no special permission needed), even if you aren’t the package author ([https://conda-forge.org/#add\_recipe](https://conda-forge.org/#add_recipe)).
