Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bunsyy/62aaf946b970b362ad6ed68b2bf0baf9 to your computer and use it in GitHub Desktop.
Save bunsyy/62aaf946b970b362ad6ed68b2bf0baf9 to your computer and use it in GitHub Desktop.
How I use Poetry with Jupyter Notebook in VSCode

Note

  • You can copy any part that you want. Feel free!
  • You can skip Step 1 and 2 if you aleady installed Poetry.

Poetry Setup Guide

Step 1 - Install Poetry

python3 -m pip install poetry

Step 2 - Verify Poetry Installation

poetry --version

Step 3 - Initialize Poetry in your Jupyter Notebook project

poetry init

Step 4 - Install dependencies

poetry add tensorflow matplotlib ipykernel

Step 5 - Get Poetry Environment Info Path

poetry env info --path

Step 6 - Activate the Poetry Environment

source your-poetry-venv/bin/activate

Step 7: Add the Poetry Environment as a Jupyter Kernel

ipython kernel install --name "your-new-poetry-env-name" --user
# OR poetry run ipython kernel install --name "tessaract-ocr-python-tuto" --user
python3 -m pip install poetry
poetry --version
poetry init
poetry add tensorflow matplotlib ipykernel
poetry env info --path
source your-poetry-venv/bin/activate
ipython kernel install --name "your-new-poetry-env-name" --user
# or
# poetry run ipython kernel install --name "your-new-poetry-env-name" --user
@LYK-love
Copy link

LYK-love commented Feb 5, 2025

I think poetry is a tool that works upon conda (or pip), not equivalent to conda. Using poetry inside a conda env is easier than using a poetry env directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment