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?
Yea so you could change that from modules
to version
then do something like
# 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.
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.
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.
Thanks. You can close the ticket.