Note: See below for instructions on how to install and run Jupyter Notebook with Anaconda or Miniconda.
We recommend using Anaconda or Miniconda to manage your Python environments. The setup for Anaconda and Miniconda will essentially be the same. Look here: https://www.educative.io/answers/anaconda-vs-miniconda to read about the differences between Anaconda and Miniconda
- Download Anaconda installer for your system at https://www.anaconda.com/, or Miniconda at https://docs.conda.io/en/latest/miniconda.html.
- Begin Installation Process:
- Linux/Unix: Open the terminal and run:
bash Anaconda-latest-Linux-x86_64.sh
orbash Miniconda3-latest-MacOSX-x86_64.sh
as appropriate. You may need to enable execution first by runningchmod +x Anaconda-latest-Linux-x86_64.sh
orchmod +x Miniconda3-latest-MacOSX-x86_64.sh
. - Windows: Run the .exe installer
- macOS: Open the .pkg file
- Follow the prompts on the screen
- Verify your installation of conda by opening the terminal (or Anaconda Prompt on Windows) and running
conda list
. A list of installed packages should appear if it is installed correctly. Note: For macOS and Linux.Unix, you can verify in the terminal, but you will have to close and open your terminal again for changes to take effect. - To create an environment, use the command:
conda create -n environment_name
, whereenvironment_name
is any name you want to name your environment. Then activate your environment withconda activate environment_name
. - To install Jupyter, with your environment activated, use the command:
conda install jupyter
- To open Jupyter Notebook, use the command:
jupyter notebook
- Open new terminal on your machine and connect to CHPC using command:
ssh [your_uid]@notchpeak.chpc.utah.edu
. The password is the same as for your Canvas account. - Download Miniconda installer:
[u1111111@notchpeak1:~]$ wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- Run the installer:
[u1111111@notchpeak1:~]$ bash ./Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/software/pkg/miniconda3 -s
- Create an user environment module. First create a directory where the user environment module hierarchy will reside, and then copy our miniconda module file to this directory.
[u1111111@notchpeak1:~]$ mkdir -p $HOME/MyModules/miniconda3
[u1111111@notchpeak1:~]$ cp /uufs/chpc.utah.edu/sys/installdir/python/modules/miniconda3/latest.lua $HOME/MyModules/miniconda3
- Load the user space miniconda module.
[u1111111@notchpeak1:~]$ module use $HOME/MyModules
[u1111111@notchpeak1:~]$ module load miniconda3/latest
-
Verify your installation of conda by running
conda list
. -
To create an environment, use the command:
conda create -n environment_name
, whereenvironment_name
is any name you want to name your environment. -
Now initialize conda by typing
conda init --all
. After you are done, the session can be closed. Open another terminal within CHPC to activate your conda and install jupyter as described below. -
Then activate your environment with
conda activate environment_name
. -
To install Jupyter, with your environment activated, use the command:
conda install jupyter
-
Now, set up a kernel to use this conda environment from Jupyter Notebook
(your_env_name) [u1111111@notchpeak1:~]$ conda install ipykernel
(your_env_name) [u1111111@notchpeak1:~]$ python3 -m ipykernel install --user --name your_env_name --display-name "Python (your_env_name)"
- Don't forget to clone this repository (if you haven't done it before)
(base) [u1111111@notchpeak1:~]$ git clone https://github.com/damtharvey/reu2023.git
- Feel free to close this terminal after you are done.
Python should already be installed in any environments you make with conda
. To install it manually, or to change the version, activate your environment and run conda install python=version
, where version
is the Python version you want to install, e.g. 3.10
. The material in this repository assumes you have at least version 3.10
.
Packages can be installed in your active envrionment using conda install package
or pip install package
. pip
tends to have more packages available than conda
.
For more information about conda environments, how to create and modify them, and what they can be useful for follow these links:
- https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
- https://www.freecodecamp.org/news/why-you-need-python-environments-and-how-to-manage-them-with-conda-85f155f4353c/
You can use your local browser to view a Jupyter Notebook on any machine you have access to, such as your own GPU server.
On the remote server, with your environment activated,
jupyter notebook --no-browser --port=8080
This should give your some http links. Copy any one of those links. You can change the port number from 8080 if you prefer.
Then, on your local machine, e.g. your laptop, run
ssh -L 8080:localhost:8080 yourname@remoteserver
where yourname
is your user name and remoteserver
is the host name of the remote server.
Then, open a web browser and paste the link that you copied from before.
If you do not have a remote machine or GPU on your machine, you can use CHPC (super-computer of the University of Utah).
-
Follow the instructions on Miniconda Installation for CHPC (if you haven't done it yet on CHPC).
-
Using your web-browser on the local machine open new window with the following address:
https://ondemand.chpc.utah.edu
-
Log in using your Username and Password.
-
Now you are on CHPC. Choose Jupyter among all the Pinned Apps
-
Create a Notebook, choose account and partition so, that it will contain "gpu" in both names. Choose Advanced Options - GPU-type [any] and click to launch
-
After a successful start connect to the Notebook, choose the Notebook you want to launch
-
After launch, in widgets go to
Kernel
->change Kernel
->Python (your env)
-
Enjoy!