{"id":23082678,"url":"https://github.com/kkmann/jupyter-singularity-demo","last_synced_at":"2025-08-15T21:35:20.518Z","repository":{"id":94998438,"uuid":"180119188","full_name":"kkmann/jupyter-singularity-demo","owner":"kkmann","description":"demo for setting up a reproducible jupyter notebook using singularity container","archived":false,"fork":false,"pushed_at":"2019-04-08T17:20:55.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-04T12:37:05.754Z","etag":null,"topics":["jupyter","notebook","reproducible-research","singularity-container"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kkmann.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-04-08T09:49:14.000Z","updated_at":"2019-04-08T17:20:57.000Z","dependencies_parsed_at":"2023-04-20T23:00:51.711Z","dependency_job_id":null,"html_url":"https://github.com/kkmann/jupyter-singularity-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kkmann/jupyter-singularity-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkmann%2Fjupyter-singularity-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkmann%2Fjupyter-singularity-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkmann%2Fjupyter-singularity-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkmann%2Fjupyter-singularity-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kkmann","download_url":"https://codeload.github.com/kkmann/jupyter-singularity-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kkmann%2Fjupyter-singularity-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270631864,"owners_count":24619384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jupyter","notebook","reproducible-research","singularity-container"],"created_at":"2024-12-16T14:57:49.887Z","updated_at":"2025-08-15T21:35:20.509Z","avatar_url":"https://github.com/kkmann.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Reproducible Jupyter Notebook using Singularity Container\n\nI *love* singularity containers and am conviced that they will play an instrumental role in making data-heavy research more reproducible. \nThere is, however, one thing that I had a hard time wrapping my head around that might be of general interest to the less container-savy users of singularity:\nBy default, singularity mounts the user home directory. \nWhile this is often convenient, it also was a source of great confusion to me since I felt that my containers where more isolated than they actually are.\nWith the default behavior, user configurations in `~/home` tend to get precedence over system-wide configurations when executing the container thus potentially changing the computing environment. \nFrom a reproducibility point of view this is very important to keep in mind when working with singularity containers!\nA good example to illustrate the issue is the installation of jupyter notebook + R kernel in a singularity container.\nBy default, jupyter writes kernel files in the users `~/.jupyter` configuarion folder and gives it precedence for config look-up during execution as well.\nSince the user home folder during execution of the container image will typically differ from the one during building the container (root!), this means that jupyter will complain about missing kernel files.\n\nFollowing the helpful discussion in https://groups.google.com/a/lbl.gov/forum/#!topic/singularity/wyxST5kHmCg (thanks!), I implemented a minimal working example of how to set up a reproducible jupyter notebook using singularity in this repository.\nIn essence, I redirect the jupyter search paths to the system config locations manually.\nDuring runtime, the home directory of the container is redirected to a temporary folder to avoid any dependencies on further configuration files.\nFirst, build the container\n```bash\n$ sudo ./build-container\n```\nthen start the notebook server \n```bash\n$ ./start-notebook-server\n```\nTake a look at the scripts above to see how the build and start of the server works. Follow the link given in the command line to open the browser interface to the notebook server and open the `demo.ipynb` notebook which uses an IRkernel and just contains a single line of R code. Try saving, and see that it works! Note that this approach provides a reproducible notebook environment (with writable for your notebooks) but does not ensure that the notebook without the container is reproducible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkmann%2Fjupyter-singularity-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkkmann%2Fjupyter-singularity-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkkmann%2Fjupyter-singularity-demo/lists"}