---
# System prepended metadata

title: Accessing jupyter lab in Datascope from your local machine
tags: [research]

---

# Accessing jupyter lab in Datascope from your local machine

## Steps needed every time you run notebooks in dsp041
- login to `dsp041`
- activate `Oceanography`
- start jupyter lab
- remote tunnel from your local

Following are some of the things which will help you do this.

Once you're in dsp041

##### Create the virtual environment 
`conda env create -f https://raw.githubusercontent.com/hainegroup/oceanspy/main/sciserver_catalogs/environment.yml`


##### Activate the virtual environment 
`conda activate Oceanography`

##### Make sure you have jupyter lab in the env
`conda install -c conda-forge jupyterlab`

##### Start jupyter lab (8080 is usually the default port)
`jupyter lab --no-browser --port=8080 --ip=$(hostname)` 

##### Open a separate terminal and tunnel into the 8080 port in dsp041
`ssh -CNL 8080:dsp041:8080 username@dslogin01.pha.jhu.edu`

##### Now open your local browser to localhost:8080/

This should work !

#### Extra (makes life easier)

##### Now, to add a toggle for the Oceanography env in jupyter, make sure that ipykernel is installed 
`pip install --user ipykernel`

##### Add the new virtual environment to Jupyter 
`python -m ipykernel install --user --name='environment_name'`

##### To list existing Jupyter virtual environments 
`jupyter kernelspec list`

You can now open a notebook in the jupyter lab with the `Oceanogrpahy` env and toggle between different envs.


