Running .exe as subprocess in Binder deployed notebook

Aloha,
I am trying to make a FloPy-based groundwater modeling project runnable in Binder so that the model can be shared with stakeholders. I can easily get the notebook up and running in Binder, but the trick is, FloPy needs to run a separate executable program (MODFLOW-NWT.exe) as a sub-process. I typically just download this .exe into my working directory. Once subprocess runs, MODFLOW-NWT.exe saves output files, and the rest of the script opens these files and post-processes model results.

The model is available at:
https://github.com/cshuler/TOGITHUB_Tutuila_2_Harry

The .exe is free to download at:
https://www.usgs.gov/mission-areas/water-resources/science/modflow-and-related-programs?qt-science_center_objects=0#qt-science_center_objects

If anyone can help to figure out how to run an external (but freely downloadable) .exe program from Binder, and I guess also how to save results as files that can then be re-opened and worked with, I would be very appreciative!
Mahalo!

I would add a postBuild file to the repository and in it have a line like:

wget http://example.com/download/this/is/a/direct/link/to/the/file

which uses the wget utility to download the file when the image is being built.

Saving files should work exactly the same as when you run things locally, they should appear in the directory where you put them.

Thanks very much betatim! I’m one step closer. I got the post build constructed and the desired .exe file shows up in my directory tree, but for some reason I can not run the .exe. If I try with the FloPy module I get the following error:
Exception: The program MODFLOW-NWT.exe does not exist or is not executable.

But I think that exception is internal to the FloPy code, since it can not access the .exe.

If I just try and run the exe by itself with subprocess I get:
PermissionError: [Errno 13] Permission denied: ‘/home/jovyan/MODFLOW-NWT.exe’

image

Therefore any help regarding getting an .exe in my home directory to run in the Binder server would be much appreciated!

Mahalo!