Use notebooks with MLOps Studio Pipelines
This article explains how to access MLOps Studio, create notebooks with the correct configuration, upload and run notebook files, install the kfp module when needed, launch MLOps Studio Pipelines from a notebook, fix a common Permission denied: ‘pipeline.yaml’ error, and run notebook environment, volume persistence, GeoPandas, and GPU tests.
Overview
MLOps Studio notebooks can be used in two different ways depending on the configuration selected during notebook creation:
Allow access to MLOps Studio Pipelines
Allow access to Jupyter Enterprise Gateway
These two options are mutually exclusive. If you want direct access to MLOps Studio Pipelines from inside the notebook, you must enable only the MLOps Studio Pipelines option.
If you choose Allow access to Jupyter Enterprise Gateway, access to MLOps Studio Pipelines requires a public endpoint and manual authorization instead of the built-in service-account-based path.
The source material attributes this limitation to a known issue in Jupyter Enterprise Gateway, which does not work correctly with kernels when Istio is configured in the way required for MLOps Studio Pipelines integration.
Prerequisites
Before starting, make sure that:
You have access credentials for the MLOps Studio environment.
You have received the required Kubernetes configuration file, if your access method requires one.
You can use kubectl on your local machine if you want to open MLOps Studio through port-forwarding.
You have permission to create notebooks in your namespace.
You have an .ipynb file ready if you plan to upload and run one.
For the GeoPandas smoke test, your environment provides access to the required custom image and GPU resources.
Access MLOps Studio
In some environments, MLOps Studio is accessed through kubectl port-forward.
Step 1. Check whether kubectl is installed
Install kubectl if needed, or verify that it is already available:
kubectl version --client
Step 2. Obtain the configuration file
Get the Kubernetes configuration file from the platform team or developers and save it locally.
Step 3. Export KUBECONFIG
Set the KUBECONFIG variable to the location of the file:
export KUBECONFIG=/Users/[user]/Desktop/kubeflow-config.yaml
Step 4. Start port-forwarding
Run:
kubectl port-forward svc/istio-ingressgateway -n istio-system 8080:80
Step 5. Verify cluster access
In another terminal, check whether the cluster is reachable:
kubectl get nodes
If this returns results, open:
http://localhost:8080/
Step 6. Sign in
Use the credentials provided by the platform team, then click Sign in with Dex.
If everything is configured correctly, you should now see the MLOps Studio interface.
Notebook configuration variants
When creating a notebook, two configuration variants are supported:
Allow access to Jupyter Enterprise Gateway
Allow access to MLOps Studio Pipelines
Important behavior
These two variants are mutually exclusive.
If you want to use MLOps Studio Pipelines directly from the notebook, select only Allow access to MLOps Studio Pipelines.
If you use Allow access to Jupyter Enterprise Gateway, then direct MLOps Studio Pipelines access from the notebook is not available in the same way. In that case, you may need to rely on a public endpoint and manual authorization.
Notebook configuration options for MLOps Studio Pipelines and Jupyter Enterprise Gateway.
Allow access to MLOps Studio Pipelines
This option allows the notebook to access MLOps Studio Pipelines without additional configuration.
Authentication is handled through a Service Account token mounted directly into the notebook pod.
Example:
!pip install kfp
from kfp.client import Client
client = Client()
run = client.create_run_from_pipeline_package(
'pipeline.yaml',
arguments={
'recipient': 'World',
'phrase': 'This is a custom phrase from the SDK.'
},
)
Allow access to Jupyter Enterprise Gateway
This option allows the use of different programming languages in notebooks by using kernels launched through Jupyter Enterprise Gateway.
Choose this when multi-kernel support is more important than direct MLOps Studio Pipelines integration.
Example notebook using the Jupyter Enterprise Gateway configuration.
Create a notebook for MLOps Studio Pipelines
If your goal is to run MLOps Studio Pipelines from inside a notebook, create the notebook with the correct configuration.
Steps
Open MLOps Studio.
Click Notebooks and then New Notebook.
Open Advanced Options.
In Configurations, select Allow access to MLOps Studio Pipelines.
Set a notebook name.
Leave the other values at their defaults unless you need something specific.
Click Launch.
Once the notebook is ready, click Connect.
Expected result
The notebook starts successfully and opens without requiring additional pipeline-specific authentication setup.
Upload a notebook file and run it
After creating the notebook, you can upload an existing .ipynb file and execute it.
Steps
In the notebook interface, click the Upload icon.
Upload icon in the MLOps Studio notebook interface.
Select the .ipynb file from your computer.
Drag or place the file into the notebook file area if needed.
Upload area for adding a notebook file to MLOps Studio.
Open the uploaded notebook.
Run each code cell sequentially.
On macOS, you can run each cell with COMMAND + ENTER.
Running notebook cells sequentially in MLOps Studio.
Expected result
The entire file runs successfully and there are no errors.
Install kfp when needed
Some notebook images do not include the kfp module by default.
If kfp is missing, add the following command at the top of the notebook and run it first:
!pip install kfp --user
This installs the MLOps Studio Pipelines SDK in the user environment.
Launch a MLOps Studio Pipeline from a notebook
Once the notebook is configured for MLOps Studio Pipelines access, you can upload a notebook file that compiles or runs a pipeline.
Typical workflow
Start MLOps Studio.
Create a notebook with Allow access to MLOps Studio Pipelines enabled.
Connect to the notebook.
Upload the notebook file.
Run the code blocks in order.
Check whether the pipeline completes without errors.
Expected result
When the run succeeds, results should be visible in three places:
MLOps Studio → Pipelines → Runs
MLOps Studio → Pipelines → Experiments
Horizon → Object Storage → Containers
Fix “Permission denied: ‘pipeline.yaml’”
This error may occur when using a notebook configured with Jupyter Enterprise Gateway.
Cause
In that setup, writing the compiled pipeline file to the default working path may fail.
Typical code that may fail
from kfp import compiler
compiler.Compiler().compile(hello_pipeline, 'pipeline.yaml')
Fix
Replace it with code that writes the file into the user’s home directory:
from kfp import compiler
from pathlib import Path
import os
home_dir_os = os.path.expanduser("~")
package_path = os.path.join(home_dir_os, "pipeline.yaml")
compiler.Compiler().compile(hello_pipeline, package_path)
This avoids the permission problem by using a location that is writable for the notebook user.
Smoke test: notebook without Jupyter Enterprise Gateway
This smoke test verifies that a custom notebook image works correctly without Jupyter Enterprise Gateway.
Objective
The goal is to confirm that:
the GPU is visible and usable in Python through PyTorch CUDA,
geopandas works correctly,
terratorch imports correctly and reports the expected version,
the kernel is local rather than running through Jupyter Enterprise Gateway.
Test image and resources
The source material uses this image:
registry.cloudferro.com/hostersi/mlops/tenants-argocd/jeg-kernels/scipy-geopandas:v3.2.3
The test assumes one NVIDIA GPU is attached.
Step 0. Cleanup
Before starting, go to Notebooks and remove any old test notebooks.
Make sure nothing remains stuck in the Terminating state.
Step 1. Create the notebook
In the UI, create a Custom Notebook with the following settings:
Name: no-jeg-gpd-terratorch-smoke
Image: registry.cloudferro.com/hostersi/mlops/tenants-argocd/jeg-kernels/scipy-geopandas:v3.2.3
CPU: 2
RAM: 8Gi
GPU: 1 NVIDIA
Configurations (Advanced): do not select Allow access to Jupyter Enterprise Gateway
Then create or launch the notebook.
Expected result:
the notebook reaches Running or Ready
JupyterLab opens successfully
Step 2. Confirm the absence of JEG environment variables
Open a terminal in JupyterLab and run:
env | egrep -i 'JUPYTER_GATEWAY_URL|JUPYTER_GATEWAY_|EG_' || echo "NO_JEG_ENV"
Expected result:
there is no JUPYTER_GATEWAY_URL
there are no JUPYTER_GATEWAY_* variables
Kubernetes service variables with similar-looking names may still appear, and that is normal
Step 3. Confirm that the GPU is visible at system level
In the terminal, run:
nvidia-smi -L
Expected result:
the GPU is listed, for example GPU 0: NVIDIA …
Step 4. Run the minimal library smoke test
Python and NumPy
Run:
import sys, numpy as np
print("python:", sys.version.replace("\n"," "))
print("numpy:", np.__version__)
Expected result:
no import errors
Python and NumPy versions are printed
GeoPandas reprojection
Run:
import geopandas as gpd
from shapely.geometry import Point
gdf = gpd.GeoDataFrame({"id":[1]}, geometry=[Point(19.94, 50.06)], crs="EPSG:4326")
p = gdf.to_crs(3857).geometry.iloc[0]
print("geopandas:", getattr(gpd, "__version__", "?"))
print("x3857:", float(p.x), "y3857:", float(p.y))
Expected result:
no exceptions
the GeoPandas version is printed
reprojected coordinates are printed in EPSG:3857
PyTorch CUDA and TerraTorch
Run:
import torch, importlib.metadata as m
print("torch:", torch.__version__)
print("cuda_available:", torch.cuda.is_available())
print("device_count:", torch.cuda.device_count())
if torch.cuda.is_available():
print("device_0:", torch.cuda.get_device_name(0))
x = torch.randn((1,), device="cuda")
print("cuda_tensor_ok:", float(x.detach().cpu().item()))
import terratorch
print("terratorch_version:", m.version("terratorch"))
Expected result:
cuda_available: True
the GPU name is shown
a CUDA tensor is created successfully
terratorch_version is printed
there are no NumPy ABI-related warnings or exceptions
Step 5. Optional proof that the kernel is local
In the notebook, run:
!hostname
Then in the terminal, run:
hostname
Expected result:
both values are the same
This confirms that the kernel is running locally in the notebook pod rather than through Jupyter Enterprise Gateway.
Final pass criteria for the smoke test
The smoke test is considered successful if all of the following are true:
JUPYTER_GATEWAY_URL is absent
nvidia-smi -L works
numpy imports correctly
geopandas reprojection with to_crs works
torch.cuda.is_available() returns True
CUDA tensor creation works
terratorch imports correctly and reports its version
Test RStudio and Visual Studio Code notebooks
Objective
Verify that notebook servers can be created with the RStudio and Visual Studio Code types and that both environments run.
Procedure
Run the following test once with RStudio and once with Visual Studio Code:
Open MLOps Studio and select Notebooks.
Click New Notebook.
Select the notebook type being tested.
Enter a name for the notebook server and configure its resources and workspace volume.
Click Launch.
Wait for the notebook server to become available, then click Connect.
Expected result
The notebook server starts successfully and the selected RStudio or Visual Studio Code environment opens without errors.
Test notebook volume persistence
Objective
Verify that data stored on a persistent volume remains available after deleting the original MLOps Studio notebook server and attaching the same volume to a new notebook server.
Create the first notebook
Open MLOps Studio and select Notebooks.
Create a new notebook server named
volume-test-notebook-1.Configure a persistent workspace volume, mount it at
/home/jovyan, and record its name for reuse.Start the notebook server.
Open JupyterLab.
Expected result
The notebook server starts successfully.
Cell 1: create test data
Open a Python 3 notebook and run the following cell:
from pathlib import Path
from datetime import datetime
import json
folder = Path("/home/jovyan/volume-test")
folder.mkdir(exist_ok=True)
results = {
"notebook": "volume-test-notebook-1",
"created_at": datetime.now().isoformat(),
"numbers": list(range(1, 11)),
"squares": [x**2 for x in range(1, 11)]
}
with open(folder / "results.json", "w", encoding="utf-8") as file:
json.dump(results, file, indent=2, ensure_ascii=False)
print("Data saved to:", folder / "results.json")
Expected result
The following file is created:
/home/jovyan/volume-test/results.json
Cell 2: verify the created file
Run the following cell:
from pathlib import Path
list(Path("/home/jovyan/volume-test").iterdir())
Expected result
The output includes:
/home/jovyan/volume-test/results.json
Save the Jupyter Notebook file as:
/home/jovyan/volume-persistence-test.ipynb
Create a text file
In JupyterLab:
Open the file browser.
Create a new text file.
Rename it to
abc.txt.Enter
abc testas its content.Save the file as
/home/jovyan/abc.txt.
Expected result
The file exists under /home/jovyan and contains:
abc test
Delete the first notebook
Stop
volume-test-notebook-1.Delete the notebook server.
Do not delete the persistent volume.
Verify that the volume still exists on the Volumes page in MLOps Studio.
Important
Reusing the existing persistent volume is required for this test. Do not delete it when you delete the first notebook server.
Create the second notebook
Create a new notebook server named
volume-test-notebook-2.Do not create a new volume.
Attach the persistent volume used by
volume-test-notebook-1.Mount it at
/home/jovyan.Start the notebook server.
Open JupyterLab.
Verify persisted data
Open a Python 3 notebook and perform the following checks.
Verify JSON data
Run the following cell:
from pathlib import Path
import json
json_file = Path("/home/jovyan/volume-test/results.json")
print("JSON file exists:", json_file.exists())
with open(json_file, encoding="utf-8") as file:
data = json.load(file)
data
Expected result
The output contains the data created by the first notebook, similar to:
{
"notebook": "volume-test-notebook-1",
"created_at": "...",
"numbers": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"squares": [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
}
Verify the text file
Run the following cell:
from pathlib import Path
text_file = Path("/home/jovyan/abc.txt")
print("Text file exists:", text_file.exists())
print("Text file content:", text_file.read_text(encoding="utf-8"))
Expected result
Text file exists: True
Text file content: abc test
Verify the notebook file
Verify that the saved Jupyter Notebook file is visible at:
/home/jovyan/volume-persistence-test.ipynb
Success criteria
The test passes when all of the following conditions are met:
results.jsoncreated by the first notebook is available in the second notebook.The data inside
results.jsonis unchanged.abc.txtis available in the second notebook.abc.txtstill containsabc test.The saved
.ipynbfile is still available.The same persistent volume was reused.
The volume was mounted at
/home/jovyanin both notebooks.
Failure indicators
The test fails if:
The second notebook starts with an empty
/home/jovyandirectory.results.jsonis missing.abc.txtis missing.The files exist but contain different data.
A new persistent volume was created instead of reusing the original one.
The volume was mounted under a different path and the expected files were not checked there.
Final result
Record the outcome as:
PASS / FAIL
What to do next
After completing these notebook and pipeline checks, the next useful topics are:
creating more advanced MLOps Studio Pipelines from notebooks,
deciding when to use Allow access to MLOps Studio Pipelines instead of Jupyter Enterprise Gateway,
validating object storage outputs produced by pipelines,
building notebook images that already include kfp and other commonly used modules.