Skip to content

add uv environment #48

@sephib

Description

@sephib

Hi,
Trying to add a script to generate a 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions