We offer several customized JupyterLab Services based on the needs of our users. Just as the Jupyter Notebooks, JupyterLab Services can be used either as the primary node for computation or simulation in your Study or it could be used as a way to perform data analysis on the data generated by other Services in your Study.
For a full demonstration of these functionalities, take a look at our webinar on JupyterLab usage!
<iframe width="784" height="441" src="https://www.youtube.com/embed/H1fB0M7FKmk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
This Service gives you a choice of creating notebooks with either Octave or Python. The Python (maths)
kernel has preinstalled modules for mathematical modeling and data analysis (see details in this requirements file).
This Service is very similar to the Jupyter Math Service, but also includes NEURON-based packages by default, including NEURON, NetPyNE and Brian2, PyNN for the Python kernel. See details in this requirements file.
This Service is another JupyterLab environment with C++ kernels pre-installed as well as the Chaste modeling framework. The C++ kernels, contributed by xeus-cling allows for interactive scripting with C++.
This Service is another JupyterLab coding environment for creating interactive Jupyter Notebooks and scripts with R (or Python). Some common packages are already installed, see details in this requirements file
This Service is another JupyterLab coding environment for creating interactive Jupyter Notebooks and scripts with Julia (or Python). Some common packages are already installed, see details in this Project.toml file
We have many more JupyterLabs available, e.g. generic ones for machine learning applications, containing PyTorch and TensorFlow, or for more specific use-cases, e.g. medical image processing. Just search for "jupyterlab" on the platform to see what is available.
You may even change the kernel of a notebook from Python to Octave or vice versa in the middle of a notebook, but note that variables are not shared across kernels. To change the kernel associated to a given notebook, double click the notebook in the file tree on the left to ensure it is being actively viewed in the main window. Then, select "Kernel" from the menu at the top of the page and choose "Change Kernel...". This will open a window with a dropdown menu containing alternative kernel options. Note that changing the kernel within a single notebook does NOT copy the predefined variables.
- Variables from one kernel will not be accessible by the other one. I.e. If a variable foo is defined in the Python kernel and you switch to Octave, foo will not be automatically defined in the Octave kernel.
- The default base directory of the JupyterLabs is
/home/jovyan/work/workspace
. This entire directory (including the inputs and outputs) will be preserved between sessions. However, files outside of this directory (e.g./home/jovyan
) will not be saved so please do not write files in other locations. Other locations, in any case, are not accessible via the File Tree UI element but can be accessed through use of the terminal. - Custom installed Python modules do not persist across sessions. Leaving a Study to the Dashboard and then re-entering the Study will result in the removal of those installed modules. A better user experience for this aspect is ongoing.
- For recent versions of JupyterLab services (e.g. JupyterLab Math >= 2.0.5), when you open the interactive view of the service, it will show some instructions on how to best use all the functionality (including how to use the Voilà mode, you can learn more about it here.
If your JupyterLab Service uses input files that come from a preceding node or Service (as opposed to direct upload from your local computer), you will need to connect the preceding input to your JupyterLab Service. This may be necessary, for example, if you are post-processing the results of computations from a collaborator's Service. Likewise, you may want to pass the output files of your JupyterLab to a subsequent Service.
To link an input from another Service TO your JupyterLab, drag and drop the output port of that Service to the input port of the JupyterLab. Then, within the JupyterLab UI, drag and drop the appropriate output file onto the input_files entry to map the file (see Linking Services for more details). The output file from the previous node will now appear in the folder inputs/input_1. To access this file in your code, it will exist in the absolute path /home/jovyan/work/inputs/input_1/file_name.ext. If the code you are running is stored in the default folder of the JupyterLab, the relative path would be inputs/input_1/file_name.ext.
NOTE: ONLY the file that is mapped into the input_files field will be available to the JupyterLab Service. If you do not map any files, the JupyterLab will not have access to anything coming from the previous node. To pass multiple files, they must be zipped first.
To allow transfer of output files FROM your JupyterLab to other nodes, either write, copy or move your output files to the outputs/output_1 folder. Linking the output port of your JupyterLab Service to the input port of the next Service will then enable the next Service to access files in your output_1 folder.
In the main window of your Service under the heading "Notebook", you will find the option to either create a new "python (maths)" or "Octave" jupyter notebook instance (by clicking either icon). Launching a notebook will automatically open a new untitled Study in your Service's main window, and start a new python/octave kernel to run your scripts.
In the main window of your Service under the heading "Console", you will find the option to either create a new "python (maths)" or "Octave" console instance (by clicking either icon). Launching a console will automatically start a new python/octave kernel for the session. For more information, see here
It is possible to open a Unix-style terminal session inside a Service to perform more actions that may not be available in the JupyterLab GUI. Some of these actions include more advanced git procedures (change/set remote repository, see status, etc.), viewing hidden files or deleting folder along with its contents. To start a terminal, click the "Terminal" icon under the heading "Other" in the main window. By default, the terminal opens in the "home" directory. Below, we provide a few useful actions using the terminal, for more complete instructions in using the terminal, see here.
Navigation to files To navigate to your projects, type:
$ cd work
and
$ ls -a
to display your files/directories, including hidden files, such as ".git", which indicates the presence of a git repository.
Install Python Packages Using Pip
You may wish to add or update python packages in the current kernel. This can be accomplished inside a python (maths) console instance using the "pip" command. Type:
import sys
!{sys.executable} -m pip install package_name
and hit "shift" + "enter" to execute the command. The package(s) will now be installed inside the current kernel session. You may need to restart the kernel to use the updated package(s).
Add and Remove Directories
To add or remove a directory using the console, navigate to the root location of the directory and type:
[ ]: mkdir <dir_name>
or
[ ]: rm -r <dir_name>
to add/remove, respectively.
To create a new text file, click the "Text File" icon in the main window under the heading "Other".
To create a new markdown file, click the "Markdown File" icon in the main window under the heading "Other". For more information regarding markdown file usage and syntax, see: 🔗 Markdown Guide.