# Binder image is picking up R packages but not Python

**URL:** <https://discourse.jupyter.org/t/binder-image-is-picking-up-r-packages-but-not-python/8773>\
**Category:** Binder\
**Created:** [April 14, 2021, 10:43pm UTC](https://discourse.jupyter.org/t/binder-image-is-picking-up-r-packages-but-not-python/8773 "2021-04-14T22:43:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gjmount](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/gjmount/32/6212_2.png) [@gjmount](https://discourse.jupyter.org/u/gjmount)\
**Post date:** [April 14, 2021, 10:43pm UTC](https://discourse.jupyter.org/t/binder-image-is-picking-up-r-packages-but-not-python/8773/1 "2021-04-14T22:43:20Z")

</div>

Hi all, I have [this repo](https://github.com/stringfestdata/london-excel) where I want to build images for both R and Python with Binder. The R packages are working fine from the `install.r` file, but I am not able to load the Python packages as defined in `requirements.txt`. Any ideas? Thanks so much.

---

<div class="post-metadata">

**Author:** ![fomightez](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/fomightez/32/495_2.png) [@fomightez](https://discourse.jupyter.org/u/fomightez)\
**Post date:** [April 15, 2021, 1:07am UTC](https://discourse.jupyter.org/t/binder-image-is-picking-up-r-packages-but-not-python/8773/2 "2021-04-15T01:07:26Z")

</div>

Yes, this is because everything is getting overridden by your Dockerfile as pointed out in the documentation [here](https://mybinder.readthedocs.io/en/latest/using/config_files.html#dockerfile-advanced-environments).

> “If a Dockerfile is present, all other configuration files will be ignored.”

You Dockerfile happens to have commands to use the `install.R` file, and so those libraries are getting installed.

A few options:

1. It is suggested for Binder is to avoid using Dockerfiles and to use the supported configuration files. If the current Dockerfile needed to be in root, you could leave it there and make a directory named `binder` and put the `install.R` and `requirements.txt` for binder in that. Use of a directory other than root is covered [here](https://mybinder.readthedocs.io/en/latest/about/about.html?highlight=root#can-i-put-my-configuration-files-outside-the-root-of-my-repository).  
However, it looks like your Dockerfile is simply for dealing with Binder. The recommended R examples are [here](https://github.com/binder-examples/r) and [here](https://github.com/binder-examples/r-conda).

2. The one with conda actually looks like it would solve most of your issues with a single configuration file, if you want to replace `Dockerfile` and `requirements.txt` in your root. Or you could put it in a `binder` directory without touching the current state of root. Conda is capable of installing many Python packages and so you probably could list most packages on the main list; however, since you are using `requirements.txt` presently, I’ll point out that an example using `pip` inside the `environment.yml` file is discussed in [this recent post](https://discourse.jupyter.org/t/binder-getting-stuck-while-installing-condas-environment-yml/8680/3). That example just has one item that would get installed with pip but you can add more to the list the way the single one currently is indented.

3. Assuming you know how to make Dockerfiles and use pip with a file (so this would be the **advanced way** ), the non-recommended way would be to add the command to your Dockerfile to run the pip install command, directing it you use your `requirements.txt`. The drawback to this way is that it is not recommended and so changes in the binder system are more likely to lead to builds breaking in the future than if you use the suggested configuration files.

---

<div class="post-metadata">

**Author:** ![gjmount](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/gjmount/32/6212_2.png) [@gjmount](https://discourse.jupyter.org/u/gjmount)\
**Post date:** [April 15, 2021, 3:04pm UTC](https://discourse.jupyter.org/t/binder-image-is-picking-up-r-packages-but-not-python/8773/3 "2021-04-15T15:04:44Z")

</div>

Wow, thanks so much for steering me in the right direction. I like the idea of using Conda.
