Jupyter AI on MCC
Jupyter AI on MCC
Jupyter AI brings AI-powered coding assistance directly into JupyterLab on the Morgan Compute Cluster (MCC). Chat with AI models, generate notebooks, and ask questions about your files. Pre-configured with campus Ollama models (no API keys needed). Users can also connect to OpenAI, Anthropic, Google Gemini, and other providers if they have their own API keys.
Getting Started
Step 1: Open MCC OnDemand
Go to https://mcc-ood.ccs.uky.edu and log in with your UKY credentials.
Step 2: Launch Jupyter AI
Click Interactive Apps in the top menu bar. Select Jupyter AI under the Servers section.
Step 3: Fill in the Launch Form
Configure your SLURM job settings:
Partition: normal (up to 7 days) or short (up to 4 hours)
Number of hours: how long you need (e.g., 4)
Number of CPU cores: how many cores (e.g., 4)
Account: your SLURM account (e.g., coa_youraccount_uksr)
Click Launch.
Step 4: Wait and Connect
Wait for the job to start (usually under a minute). When the status shows Running, click Connect to Jupyter AI.
First-Time Setup: Configure the AI Model
When JupyterLab opens, you will see the Jupyternaut chat sidebar on the left and the Launcher on the right.
To configure which AI model to use:
Click the chat icon on the left sidebar (Jupyternaut robot icon)
Click the settings gear icon at the top of the chat panel
Fill in the fields as shown below, then click Save Changes
Language Model Settings
These settings are saved per user and persist across sessions. You only need to set them once.
Field | Value |
|---|---|
Completion model | Select Ollama :: * from the dropdown |
Local model ID |
|
Base API URL |
|
Embedding Model Settings (optional, for RAG)
Field | Value |
|---|---|
Embedding model | Select Ollama :: * |
Local model ID |
|
Base API URL |
|
Make sure there are no trailing spaces after the Base API URL. A trailing space will cause connection errors.
Available AI Models
Type one of these in the "Local model ID" field:
Model | Speed | Best For |
|---|---|---|
| Fastest | Quick answers, simple code |
| Fast | Everyday coding, good all-around |
| Medium | Best chat quality, reasoning, coding |
| Medium | Best for notebook generation (/generate) |
| Slow | Strong general purpose |
| Medium | Math, logic, proofs, step-by-step reasoning |
| Medium | Newest Llama, huge context window |
These campus models require no API keys. Users can also configure OpenAI, Anthropic, Google Gemini, or other cloud providers in the settings if they have their own API keys.
Large models (70b+) take 30-60 seconds to load on first use.
Using the Chat Sidebar
The Jupyternaut chat sidebar is the main way to interact with AI. Type your question and press Enter.
Available slash commands:
Command | Description |
|---|---|
| Ask a question about your learned data (RAG) |
| Clear the chat window |
| Export chat history to a Markdown file |
| Fix an error cell selected in your notebook |
| Generate a Jupyter notebook from a text prompt |
| Teach Jupyternaut about files on your system |
When the AI generates code blocks, use the icons below each block to insert code into your notebook cells.
Generating Notebooks with /generate
The /generate command creates a complete Jupyter notebook (.ipynb file) from a text prompt.
Tips for /generate:
Switch to
qwen2.5-coder:32bin settings for best resultsWrap the entire prompt in double quotes
The prompt must be on one single line (no line breaks)
Say "TWO code cells only" to keep variables consistent across cells
Say "generate ALL data inline" to avoid missing file errors
Example /generate Prompts
Copy and paste these directly into the chat (each on one line):
Mandelbrot Set:
/generate "Create a notebook: import numpy and matplotlib. Create 800x800 grid over real=[-2,1] imag=[-1.5,1.5]. For each c iterate z=z^2+c up to 100 times. Track escape iteration when abs(z)>2. Plot as image with cmap='hot' and aspect='equal'. Add title Mandelbrot Set. All data inline. Call plt.show()."Monte Carlo Pi Estimation:
/generate "Create a notebook: import numpy and matplotlib. Set np.random.seed(42). Generate 50000 random (x,y) in unit square. Points inside quarter circle (distance from origin < 1) are hits. Estimate pi = 4*hits/total. Scatter plot: blue inside, red outside, alpha=0.1. Draw quarter circle arc. Print pi estimate. Add title. All data inline. Call plt.show()."3D Surface Plot:
/generate "Create a notebook: import numpy and matplotlib. Use np.meshgrid with np.linspace(-5, 5, 200) for x and y. Compute z = x**2 - y**2. Create a 3D surface plot with cmap='coolwarm'. Capture the surface and pass to fig.colorbar(). Set view_init(30, -60). Add title Saddle Surface. Call plt.show(). All data inline."File-Based Examples
Sample data files are available for practice at /share/examples/MCC/jupyter-ai/sample-data/:
File | Description |
|---|---|
| 14 days of weather data from 3 Kentucky stations |
| 20 genes across 6 samples (group A vs B) |
| New Madrid Seismic Zone earthquake data |
Using %%ai Magic Commands
You can use AI directly in notebook code cells. First, load the extension (once per session):
%load_ext jupyter_ai_magicsThen use %%ai in any code cell:
%%ai ollama:qwen3:32b
Write a function to calculate the Fibonacci sequence up to n termsRAG: Ask Questions About Your Files
RAG (Retrieval-Augmented Generation) lets you index your files so the AI can answer questions based on your actual documents.
Make sure the Embedding model is configured in settings
In the chat, type:
/learn /path/to/your/files/Wait for indexing to complete (1-2 minutes for small directories)
Ask questions with:
/ask What functions are defined in the Python files?
Be specific with /ask questions. Ask about exact things (function names, port numbers, config keys) for best results.
Pre-installed Libraries
These are available in the container. Do NOT pip install inside the notebook.
Category | Libraries |
|---|---|
Visualization | matplotlib, seaborn, plotly, pillow |
Data | numpy, scipy, pandas, pyarrow, openpyxl, xlrd, h5py, netcdf4 |
Machine Learning | scikit-learn, statsmodels, sympy |
Utilities | ipywidgets, tqdm, requests, beautifulsoup4, lxml |
AI | jupyter-ai, langchain-ollama |
Need another package? Submit a request at the CCS Support Portal to have it added.
Checking Available Models
Run this in a notebook cell to see all models on the Ollama server:
import requests
response = requests.get('http://gh2-internal.ccs.uky.edu:11434/api/tags')
for m in sorted(response.json()['models'], key=lambda x: x['size']):
print(f"{m['name']:<35} {m['size']/1024**3:.1f} GB")Troubleshooting
Problem | Solution |
|---|---|
Kernel error "No such file" | Go to Kernel > Change Kernel > Python 3 (ipykernel). To fix permanently: |
"Port could not be cast to integer" | Clear Base API URL field, re-enter |
"model is required (status code: 400)" | Local model ID field is empty. Enter a model name like |
/generate shows code in chat but no file | Try the same prompt again. Use |
/generate notebook has errors | Copy the error into chat and say "fix this error". Or use "TWO code cells only" in prompt |
AI responses forget context | Chat remembers 10 messages. Start a new thread (click + at top) |
Plot not showing | Make sure code ends with |
Support
For issues with Jupyter AI or the OOD app, submit a request at the CCS Support Portal.