Hi all, I have this repo 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.
Yes, this is because everything is getting overridden by your Dockerfile as pointed out in the documentation here.
“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:
-
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 theinstall.R
andrequirements.txt
for binder in that. Use of a directory other than root is covered here.
However, it looks like your Dockerfile is simply for dealing with Binder. The recommended R examples are here and here. -
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
andrequirements.txt
in your root. Or you could put it in abinder
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 usingrequirements.txt
presently, I’ll point out that an example usingpip
inside theenvironment.yml
file is discussed in this recent post. 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. -
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.
Wow, thanks so much for steering me in the right direction. I like the idea of using Conda.