cluster:usage_tips:jupyter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
cluster:usage_tips:jupyter [2022/01/07 17:08] – [Installing packages] benediktcluster:usage_tips:jupyter [2023/03/16 08:48] (current) – [Jupyter] lukab
Line 1: Line 1:
 ====== Jupyter ====== ====== Jupyter ======
 Jupyter is a notebook-based development platform for Python projects, widely used in machine learning projects. Jupyter is a notebook-based development platform for Python projects, widely used in machine learning projects.
-JuypyterHub is a service that provides Jypyter notebooks for users on a given machine. Currently, one jupyterHub server is accessible for Sleep Revolution researchers on the computing hub Salamander.+JuypyterHub is a service that provides Jypyter notebooks for users on a given machine. Currently, one jupyterHub server is accessible for Sleep Revolution researchers on the computing hub Dunwich.
  
 ===== Access ===== ===== Access =====
-In order to access the JupyterHub server, access the [[cluster:usage_tips:VPN|VPN]], and navigate to [[http://salamander.sleep.ru.is|salamander.sleep.ru.is]] (if that doesn't work you can also try [[http://130.208.209.2|130.208.209.2]]. You will be greeted with a login screen where you should use your Sleep revolution credentials (without @sleep.ru.is)+In order to access the JupyterHub server, access the [[cluster:usage_tips:VPN|VPN]], and navigate to [[https://dunwich.sleep.ru.is/jupyter|dunwich.sleep.ru.is/jupyter]]. You will be greeted with a login screen where you should use your Sleep revolution credentials (without @sleep.ru.is).
- +
-===== Usage ===== +
- +
- +
-The default JupyterHub interface has 3 python environments installed one python3 environment, one TensorFlow environment, and one PyTorch environment+
  
 ==== Adding environment ==== ==== Adding environment ====
Line 17: Line 12:
 To create a new python environment we use ''conda'', open a new terminal in jupyterhub. To create a new python environment we use ''conda'', open a new terminal in jupyterhub.
  
-The command for creating a new conda environment named ''aardvark'' for example is+The command for creating a new conda environment named ''myenv'' for example is
 <code> <code>
-conda create -n aardvark+conda create -n myenv
 </code> </code>
 Note the location of the new environment. Note the location of the new environment.
Line 26: Line 21:
  
 <code> <code>
-conda activate aardvark+conda activate myenv
 conda install ipykernel conda install ipykernel
 </code> </code>
-Finally, to register the environment with jupyterhub, type the command, replacing ''aardvark'' with the name of your environment, and ''displayname'' with a nice name for your environment that you can select from a dropdown list in jupyter.+Finally, to register the environment with jupyterhub, type the command, replacing ''myenv'' with the name of your environment, and ''displayname'' with a nice name for your environment that you can select from a dropdown list in jupyter. 
 + 
 +You also need to replace the path to your environment with by replacing "myenv" with the name of your environment and adjusting the python version at the end of the path if necessary. 
 <code> <code>
-.conda/path/to/environment/bin/python -m ipykernel install --name 'aardvark' --display-name "displayname"+.conda/envs/myenv/bin/python3 -m ipykernel install --name 'myenv' --display-name "displayname" --user
 </code> </code>
  
-To remove the ''aardvark'' environment, the command is:+To remove the ''myenv'' environment, the command is:
 <code> <code>
-jupyter kernelspec uninstall aardvark+jupyter kernelspec uninstall myenv
 </code> </code>
 +=====Working in Jupyter Notebooks=====
 +
 +Now you are ready to create your own Jupyter Notebook. Click the blue plus button in the main screen and select an environment, e.g. your newly created //myenv//.You can change the environment later by selecting a different kernel. 
  
 ==== Installing packages ==== ==== Installing packages ====
  
-To install a package, ''superpackage'' for example, to the example environment ''aardvark'' that you created and added to the JupyterHub open a new python console on JupyterHub by selecting the ''aardvark'' environment and executing the +To install a package, ''examplepackage'' for example, to the example environment ''myenv'' that you created and added to the JupyterHub open a new **python console** on JupyterHub by selecting the ''myenv'' environment and executing
  
-''conda install superpackage''+''conda install examplepackage''
  
-After the installation, you should be able to restart the kernel, and use your new ''superpackage''+After the installation, you should be able to restart the kernel, and use your new ''examplepackage'' 
 + 
 +====Access Data===== 
 + 
 +The path to access data from the sleep database always starts with ///datasets// 
 + 
 +**EXAMPLE:** 
 +If the name of your data set is "examplesleepstudy" you can read an .csv file in this folder like this: 
 + 
 +<code> 
 +pd.read_csv("/datasets/examplesleepstudy/examplefile.csv"
 +</code> 
 + 
 +In oder to explore the structure of the folder you are trying to access use the terminal to show the contents of the folder: 
 + 
 +<code> 
 +ls /datasets/examplesleepstudy 
 +</code>
  
  • cluster/usage_tips/jupyter.1641575304.txt.gz
  • Last modified: 2022/01/07 17:08
  • by benedikt