# Setting up Tensorflow with Jupyter et. al

**URL:** <https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881>\
**Category:** Get Help\
**Tags:** question\
**Created:** [April 30, 2020, 7:34pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881 "2020-04-30T19:34:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cupdike](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/cupdike/32/435_2.png) [@cupdike](https://discourse.openondemand.org/u/cupdike)\
**Post date:** [April 30, 2020, 7:34pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881/1 "2020-04-30T19:34:03Z")

</div>

I’ve got Jupyter/JupyterLab and Slurm working but I’m not sure how to fully build out what I need–that is Tensorflow GPU for notebooks and Slurm. I have anaconda installed on the nodes but between Jupyter, kernels, conda, and Lmod, I’m not sure how to put it all together. Can someone point me to any references that might help (or even just advice/guidance). I’ve never tried to set up these things for a clustered environment before. Thanks.

---

<div class="post-metadata">

**Author:** ![maflister](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/maflister/32/139_2.png) [@maflister](https://discourse.openondemand.org/u/maflister)\
**Post date:** [April 30, 2020, 8:36pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881/2 "2020-04-30T20:36:53Z")

</div>

Do you have TensorFlow already installed in your cluster?

We have to use a Singularity container here for TensorFlow. So, we installed Jupyter in that same container, and then used that container as the backend for our OOD Jupyter app. Jupyter launches within the container environment, and the TensorFlow package (in the container) can be imported.

---

<div class="post-metadata">

**Author:** ![cupdike](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/cupdike/32/435_2.png) [@cupdike](https://discourse.openondemand.org/u/cupdike)\
**Post date:** [April 30, 2020, 8:46pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881/3 "2020-04-30T20:46:00Z")

</div>

It’s actually an NVidia DeepOps POC on some OpenStack nodes, so technically Tensorflow is available via nvidia-docker. Can you post the relevant parts of your Jupyter app code/config/yaml? I might be able to translate it for nvidia-docker. Thanks…

---

<div class="post-metadata">

**Author:** ![maflister](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/maflister/32/139_2.png) [@maflister](https://discourse.openondemand.org/u/maflister)\
**Post date:** [April 30, 2020, 9:32pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881/4 "2020-04-30T21:32:53Z")

</div>

Using Singularity, there’s only one change required to the `template/script.sh.erb` file.  
Replace:  
`jupyter notebook --config="${CONFIG_FILE}" <%= context.extra_jupyter_args %>`

With:  
`singularity exec /path/to/my/TF_container.sif jupyter notebook --config="${CONFIG_FILE}" <%= context.extra_jupyter_args %>`

---

<div class="post-metadata">

**Author:** ![cupdike](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/cupdike/32/435_2.png) [@cupdike](https://discourse.openondemand.org/u/cupdike)\
**Post date:** [May 1, 2020, 7:08pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881/5 "2020-05-01T19:08:40Z")

</div>

Thanks… that was pretty easy to get set up. I did it like this to also provide JupyterLab:

```
singularity exec /path/to/my/TF_container.sif \
  jupyter <%= context.jupyterlab_switch == "1" ? "lab" : "notebook" %> \
  --ip="0.0.0.0" \
  --config="${CONFIG_FILE}" <%= context.extra_jupyter_args %>

```

Also a form tweak required for JupyterLab: [JupyterLab Installed](https://discourse.openondemand.org/t/jupyterlab-installed/594/5)

By the way, I notice you are exec’ing a container. I’m new to Singularity, but wouldn’t that normally be an image in a multiuser environment? I’m guessing there’s something I don’t understand. Thanks…

---

<div class="post-metadata">

**Author:** ![maflister](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/maflister/32/139_2.png) [@maflister](https://discourse.openondemand.org/u/maflister)\
**Post date:** [May 1, 2020, 7:28pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881/6 "2020-05-01T19:28:39Z")

</div>

Glad to hear it worked. Not sure I follow your Singularity question. I’m definitely not a Singularity expert but happy to explain if you can provide more context.

---

<div class="post-metadata">

**Author:** ![cupdike](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/cupdike/32/435_2.png) [@cupdike](https://discourse.openondemand.org/u/cupdike)\
**Post date:** [May 1, 2020, 7:35pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881/7 "2020-05-01T19:35:49Z")

</div>

Never mind! I was looking at an old video that used a .simg extension when pulling from a Docker repo. I think that’s legacy terminology now replaced by .sif

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:43pm UTC](https://discourse.openondemand.org/t/setting-up-tensorflow-with-jupyter-et-al/881/8 "2022-05-26T15:43:18Z")

</div>


