# Jupyter modules

**URL:** <https://discourse.openondemand.org/t/jupyter-modules/815>\
**Category:** Get Help\
**Created:** [April 2, 2020, 1:59pm UTC](https://discourse.openondemand.org/t/jupyter-modules/815 "2020-04-02T13:59:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasbrTTU](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/thomasbrttu/32/249_2.png) [@thomasbrTTU](https://discourse.openondemand.org/u/thomasbrTTU)\
**Post date:** [April 2, 2020, 1:59pm UTC](https://discourse.openondemand.org/t/jupyter-modules/815/1 "2020-04-02T13:59:47Z")

</div>

When you include the modules in the attributes section is that only used for starting the Jupyter notebook server? So if python2.7 is available on the compute node automatically then we can suppress the modules: “python” line?

file is ~/ondemand/dev/jupyter/form.yml

* * *

cluster: “cluster1”  
attributes:  
modules: “python”  
extra\_jupyter\_args: “”  
bc\_num\_slots:  
label: “Number of nodes”

If we want users to be able to access python 3 in the Jupyter notebook (default is python 2.7) and other modules such as numpy, scipy, etc. (using import) in what file do we have to load them and possibly do a pip install?

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 2, 2020, 2:48pm UTC](https://discourse.openondemand.org/t/jupyter-modules/815/2 "2020-04-02T14:48:25Z")

</div>

Yea so you could change that from `modules` to `version` then do something like

```ruby
# this will boot python3 or python2.7 depending on the version chosen
/usr/bin/python<%= context.version %> jupyter lab --config="${CONFIG_FILE}"

```

The file you want to do this in is `template/script.sh.erb`. This is the main job script file.

---

<div class="post-metadata">

**Author:** ![thomasbrTTU](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/thomasbrttu/32/249_2.png) [@thomasbrTTU](https://discourse.openondemand.org/u/thomasbrTTU)\
**Post date:** [April 2, 2020, 10:08pm UTC](https://discourse.openondemand.org/t/jupyter-modules/815/3 "2020-04-02T22:08:14Z")

</div>

Added the following two lines to the template/script.sh.erb before running  
jupyter notebook --config="${CONFIG\_FILE}" \<%= context.extra\_jupyter\_args %\>

. $HOME/conda/etc/profile.d/conda.sh  
conda activate python-OOD

The conda environment was created with the following:

conda create -n python-OOD python=3.6 scipy numpy pandas matplotlib  
conda activate python-OOD  
conda install -c conda-forge jupyterlab

Will eventually allow the user to enter the conda environment through the form.yml and use the ERB template to load the appropriate conda environment in the above statement.

Now OOD runs Jupyter notebook with python 3.6.10. When I look at the compiler options it gives python 2 and python 3. If you use the python 2 option it gives you python 3 compiler (understand using the json kernel file). Used “jupyter kernelspec list” to display the two kernels.

Tried deleting the python2 kernel using

jupyter kernelspec remove python2 and  
sudo jupyter kernelspec remove python2

but it asks for a password. Reset my password in the Jupyter terminal using

jupyter notebook password

and re-executed the

sudo jupyter kernelspec remove python2

but it didn’t recognize my (new) password. Could delete the directory associated with python2 but may cause other problems.

What happens when I migrate the install to System Apps? Will each user have to create there own password. I could change it using c.Notebook.password = ‘’ but that would probably break something.

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 3, 2020, 1:46pm UTC](https://discourse.openondemand.org/t/jupyter-modules/815/4 "2020-04-03T13:46:47Z")

</div>

When BC apps get migrated from dev to system apps they execute in the _exact same manner_. There’s no difference in execution.

Users do create they’re own password (in the `before.sh.erb`) through the randome device on every job. So any given password is only good for that session.

I don’t know about the `sudo` though, if users will be able to do that. It may be worthwile to think about using a container instead of the hosts’ python.

---

<div class="post-metadata">

**Author:** ![thomasbrTTU](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/thomasbrttu/32/249_2.png) [@thomasbrTTU](https://discourse.openondemand.org/u/thomasbrTTU)\
**Post date:** [April 3, 2020, 7:42pm UTC](https://discourse.openondemand.org/t/jupyter-modules/815/5 "2020-04-03T19:42:22Z")

</div>

Thanks. You can close the ticket.

---

<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/jupyter-modules/815/6 "2022-05-26T15:43:19Z")

</div>

Closed on May 26, 2022, 3:43pm UTC


