Project.toml in binder subdirectory not installing packages

I have a Julia repo, and I created a Project.toml file in the binder subdirectory of the root directory of my repo. This seems to work for specifying the version of Julia to use, however, the packages listed in the Project.toml file are not loaded when the Binder is launched. However, if I move the Project.toml file to the root directory of the repo, then it seems to work properly.

Is this known behavior? A bug? Is there any workaround? I’d prefer not to have the Project.toml file in the root directory.

Hi @will
Can you provide a link to the repo?

Hi @manics,

Here are two sample binders:

Each repo contains just a Project.toml file, but in binder1 it’s placed in the root, and in binder2 it’s in the “binder” subdirectory.

The environment described in Project.toml is instantiated in the case of binder1, but not in binder2.

Hello, I have observed a very similar behavior.
I have a repo with an unregistered Julia package that has a Project.toml.
I want to set up a binder for this repo that should also contain some other packages that I don’t want to have as dependencies of my package (e.g. Plots.jl). I tried to add a folder called binder with another Project.toml containing further packages. But this doesn’t seem to be used by binder but only the Project.toml in the root of the repo is used.

Is there any solution to this?

Hi @cwod!

Binder can’t recognise files stored in multiple locations, e.g. root AND a subdir, it has to be one or the other. I would recommend having your binder config files in a separate branch which is built by binder, then use nbgitpuller to pull in your content. You can find more info and an example here: How can I separate my Binder setup files from my content? — Binder 0.1b documentation

Hi @sgibson91,

thanks for your answer. Just to make sure I understand correctly:
In my case I want binder to use the Project.toml in the “binder” folder and to ignore the one in the root of the repo. But this is not possible and binder will still only use the one in the root? Because here it says that if there is a “binder” folder, the config files in root should be ignored.

Hmmm, it could be possible but if it’s not working, perhaps we have a bug? Could you test by temporarily removing the Project.toml files/binder directory in turn and seeing which packages are installed vs which ones you’re expecting to be installed? You can test locally with repo2docker rather than waiting for mybinder.org to build it: https://repo2docker.readthedocs.io

1 Like

Hi,

so I tried some things and it seems the problem is that Binder is not correctly installing the dependent packages if the Project.toml is in the “binder” folder.
I tried setting up a repo with no Project.toml in root but only in a “binder” folder and then things don’t work as expected.

The test-repo can be found here: GitHub - Cornelius-G/TestBinder
It has 3 branches:

  • Main has a Project.toml in root with only 1 of the 2 required packages in it and another Project.toml in “binder” that has both required packages in it (this is what I would like to do)
  • justroot has the Project.toml with both required packages in root: Everything works fine
  • justbinderfolder: Only has a Project.toml with both packages in the “binder” folder, none in root. Packages are not working.

Is this the expected behavior? From the Github issue I mentioned above, I would expect all three branches to work the same, or am I misunderstanding something or doing something wrong?

1 Like

I think this is a bug, could you open a bug report on GitHub - jupyterhub/repo2docker: Turn repositories into Jupyter-enabled Docker images please? The packages should work regardless of where they are installed from.

1 Like

Hello,
I have the same problem with binder. I want to start my repository in binder with a Project.toml from a subdirectory. Is there any solution to the bug from above?

Or alternatively is there any other solution for this but using an extern repository?
If there is anything that already answers my question, I’m sorry I didn’t find it.