# Jupyter with Environment File on Cluster A summary on how to launch a Jupyter notebook with specific Conda environment file. Before you start, make sure to download and install [Anaconda](https://www.anaconda.com/). Also, you have to download our project from the GitHub page. The project contains the environment files we use. Two environments (TensorFlow 1/ TensorFlow 2) we are using for this class: - TensorFlow 2 ([Mac](https://github.com/AOS551/AOS551_PINN_tf2/blob/main/environment-osx.yml), [Win](https://github.com/AOS551/AOS551_PINN_tf2/blob/main/environment-win.yml)) - TensorFlow 1 ([Mac](https://github.com/AOS551/AOS551_PINN_tf1.14/blob/main/environment-osx.yml), [Win](https://github.com/AOS551/AOS551_PINN_tf1.14/blob/main/environment-win.yml)) ## Using Jupyter Locally - Launch Terminal - For Windows, you must use [**Anaconda Prompt**](https://hackmd.io/_uploads/Skt-qJLmt.png) - For Mac, use the regular terminal - Create the environment by executing `conda env create -f <the .yml file>` - It will take few minutes to download and install the environment. - Activate environment by executing `conda activate <My Environment>` - `<My Environment>` should be `tf24`, `tf25`, or `tf114` created in the previous step. - Launch Jupyter by executing `jupyter notebook`, and it should open Jupyter using a Web browser. ## Using Jupyter On Cluster (Della/Adroit) 1. Download the code from [our class Gituhb](https://github.com/AOS551/AOS551_Curve-fitting) to your local machine. Remember the directory of the code. For example `Downloads/AOS551/AOS551_Curve-fitting-main/` 2. Open terminal on your local machine. Use the following command to copy the folder of codes into your Adroit account: `scp -r <directory_of_your_code> <username>@adroit.princeton.edu:/scratch/network/<username>` 3. Make directories writeable - Log into Adroit with `ssh <username>@adroit.princeton.edu` - Run this on the command line `chmod -R u+w /scratch/network/<username>/` 4. Create environment: (Skip this step if you had already done it before) - Log into Adroit with `ssh <username>@adroit.princeton.edu` - Change directory into your scratch directory with `cd ../../scratch/network/<username>/` - Creating the environment while under the /scratch directory will keep more free space on your home directory (which only has 10GB on Adroit) - Load Anaconda with `module load anaconda3/2020.7` - Create the environment by executing `conda env create -f <the .yml file>` - We use [**Mac environment file**](https://github.com/AOS551/AOS551_Curve-fitting/blob/main/environment-osx.yml) on the cluster For example, because your .yml file is preiviously saved along with the code under the home directory using scp, you will use `conda env create -f AOS551_Curve-fitting-main/environment-osx.yml` - It will take few minutes to download and install the environment. 5. Launch the Web interface of the cluster ([Della](https://mydella.princeton.edu/), [Adroit]( https://myadroit.princeton.edu)) - Select `Interactive Apps` -> `Jupyter for Classes` - Input parameters for the Jupyter - For class materials, `1 hour`, `1 core`, `8 (GB) Memory`, and `AOS551` would work. - Click `Launch` (it takes time) -> `Connect to Jupyter` - Click the target Jupyter notebook file - Click `File` -> `Trust Notebook` - **Switch the kernel to the target environment** by click `Kernel` -> `Change kernel` ![](https://hackmd.io/_uploads/S1vlGb8Qt.png) 6. Remember to delete the session after use