DEV Community

Cover image for Need a different version of Python in SageMaker Studio Jupyter Notebooks? Here's how to create your own tile in the launcher!
Faye Ellis for AWS Community Builders

Posted on

3

Need a different version of Python in SageMaker Studio Jupyter Notebooks? Here's how to create your own tile in the launcher!

SageMaker Studio provides a cost effective and convenient way to access Jupyter Notebooks for running Python code, but what if you need a different version of Python, than the default one on offer?

Here's how to create your own bespoke virtual environment with everything you need to run your code.

1) In the SageMaker Studio Jupyter Lab, select terminal from the launcher.

Image description

2) In the terminal window, type this command which creates a new Python virtual environment, then downloads, extracts, and installs the specified version of Python that you need for your project.

conda create -n python_312 python=3.12.*
Enter fullscreen mode Exit fullscreen mode

Image description

3) Continuing in the terminal window, type the following command to activate the environment.

source activate python_312
Enter fullscreen mode Exit fullscreen mode

4) Next install the libraries needed for Jupyter notebooks (ipykernel and jupyterlab). At this point you can add any other libraries that you need in this environment. For my use case, I also needed matplotlib for creating visualizations, so I added that too!

python -m pip install ipykernel jupyterlab matplotlib
Enter fullscreen mode Exit fullscreen mode

5) Now we are ready to add our newly created Python environment to the Jupyter Lab launcher. I named it my_python_312_env.

python -m ipykernel install --user --name python_312 --display-name my_python_312_env
Enter fullscreen mode Exit fullscreen mode

Image description
After running this command, close the terminal session.

6) The new Python environment now appears in the SageMaker Studio Jupyter Lab launcher screen, select it, by selecting my_python_312_env!

Image description

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post

đź‘‹ Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay