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
@JoaoKbral
Copy link

So, I'm not sure if this has ended or not but when you first run the project vscode will ask you to choose a kernel, select the one that poetry created, that's all
image
if it doesn't ask you can click in the place that shows the kernel version that is highligthed
image

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