aws-samples / aws-samples/sagemaker-studio-lifecycle-config-examples

add uv environment

Open
#48 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Shell
Stars
88
Forks
54
PR merge metrics
No merged PRs in 30d

Description

Hi,
Trying to add a script to generate a [UV](https://docs.astral.sh/uv/) environment to run the notebook kernel with
my scripts is
```
#!/bin/bash

set -e

# Install UV
curl -LsSf https://astral.sh/uv/install.sh | sh

# Add UV to PATH
echo 'export PATH=$PATH:/home/sagemaker-user/.cargo/bin' >> /home/sagemaker-user/.bashrc
source /home/sagemaker-user/.bashrc

echo 'Create a virtual environment using UV'
PYTHON_VERSION =
uv venv --python 3.12.5 /home/sagemaker-user/SageMaker/venv

echo 'Activate the virtual environment'
source /home/sagemaker-user/SageMaker/venv/bin/activate

echo 'Install ipykernel in the virtual environment'
uv pip install ipykernel polars

echo 'Create a Jupyter kernel for the UV virtual environment'
python -m ipykernel install --user --name=uv_venv --display-name="UV Python 3.12.5"

# Deactivate the virtual environment
deactivate

echo "UV virtual environment setup complete and Jupyter kernel installed."
```

In the notebook I can see the kernel
But when I choose it I get the following error
> Failed to start kernel
>Internal Server Error (Context: RequestId: c89a6f01-9145-4141-a562-0e42cba15df7, TimeStamp: 1726603383.1354425, Date: Tue Sep 17 20:03:03 2024)

any suggestions?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.