Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Note: Access to JupyterHub is only available for users on projects that have paid for additional processing power. 
  2. If you have requested JupyterHub and this has been confirmed you will need to log on to the SAIL Gateway as normal. Once within the Windows 10 environment, open up your Browser and navigate to - httphttps://jupyterhub.sail.k8spk.chi.swanserp.ac.uk/ 
  3. Click the orange ' login with Keycloak' button and follow the instructions. Your login is the same as the one you use to log into the SAIL Gateway.
  4. Following this, you will be logged into JupyterHub and will see a list of notebooks to choose from. Assuming that you are on a GPU project you will see a minimum of 3 options:
    1. The first is a basic (non-GPU) notebook. This has python and R kernels installed, and also allows you to launch VS Code and RStudio from within the notebook if you prefer a more fully-featured IDE.
    2. The second is a notebook with the same features as the first that will attach itself to a GPU, but that does not contain any GPU drivers or related python libraries. You will have to install all of your own GPU drivers from within the notebook if you select this. We do not recommend the use of this option, and it will likely be removed in a future release.
    3. The third is a GPU-attached notebook with CUDA 11.612.2, Tensorflow, and other common python ML libraries preinstalled. It is configured to automatically surface your specific project GPU to Tensorflow within the notebook. This notebook notebook only supports Python. It also includes VS Code and Tensorboard, as well as an extension for monitoring your GPU resource usage.
  5. If you are on more than 1 GPU project (e.g. project 1234 with GPU and project 1653 with GPU) you will see separate options in the notebook image list for each project. In this case, the list will look something like this:
    1. Standard Jupyter notebook
    2. Standard Jupyter notebook with GPU for project 1234
    3. GPU-enabled Jupyter notebook with GPU for project 1234
    4. Standard Jupyter notebook with GPU for project 1653
    5. GPU-enabled Jupyter notebook with GPU for project 1653

...

The notebooks are configured so that any new conda environment you create (see Installing Library Packages in Anaconda) can be configured to show a corresponding kernel launcher on your Jupyter homepage. For this reason, we recommend that users primarily install packages via Anaconda, rather than pip or CRAN, where possible.

Python

  1. Open a Terminal window from the homepage.
  2. If you see a line like "bash: __conda_exe: command not found" at the top of the Terminal window, type "conda init", close the Terminal window, and then launch it again from the homepage.
  3. Create a new conda environment to install your package in, conda create --name myshinynewenv ipykernel ibm_db
    1. *UPDATE 02/08/2023: If you want to connect to DB2 you need to install the ibm_db package at the same time as the ipykernel package due to conflicting Python minor versions*
  4. Activate your new environment, conda activate myshinynewenv
  5. Install your package, e.g. conda install -c conda-forge recordlinkage
  6. You can also install from pip in the traditional way, ensuring you activate the environment (step 3) that you want to install the package into first.
  7. When you close the Terminal window and return to the homepage you should see a new python kernel with the same name as your new conda environment.

...

There are two options for moving files from your SAIL desktop and into your Jupyterhub Notebook.

  1. If the file is under 8mb 8gb you can simply drag and drop it into the browser window.
  2. Or you can sync it via GitLab (very much the recommended option).

...

Code Block
languagepy
themeMidnight
linenumberstrue
import ibm_db
import ibm_db_dbi
import pandas as pd

db = 'PR_SAIL'
hostname = 'db2.database.ukserp.ac.uk'
port = '60070'
protocol = 'TCPIP'
uid = 'YOUR USERNAME HERE'
pwd = 'YOUR PASSWORD HERE'
security = 'ssl'
ssl_client_keystoredb = '/db2conndb2-connection/chi.kdb'
ssl_client_keystash = '/db2conndb2-connection/chi.sth'

conn_str = ("DATABASE={0};"
			"HOSTNAME={1};"
			"PORT={2};"
			"PROTOCOL={3};"
			"Security={4};"
			"UID={5};"
			"PWD={6};"
			"SSLClientKeystoredb={7};"
			"SSLClientKeystash={8};").format(db, hostname, port, protocol, security, uid, pwd, ssl_client_keystoredb, ssl_client_keystash)

conn = ibm_db.connect(conn_str, '', '') 
pd_conn = ibm_db_dbi.Connection(conn)

q = 'SELECT * FROM syscat.tables LIMIT 5'
df = pd.read_sql(q, pd_conn)
print(df)

...