Jupyter kernel doesn't use Poetry environment

Viewed 758

I'm trying to install a Jupyter kernel for my poetry environment, but it seems like the kernel gets my base conda environment. Here's what I'm trying:

poetry env list
>ENV_NAME-HASH-py3.9 (Activated)

poetry run which python
>/Users/myusername/Library/Caches/pypoetry/virtualenvs/ENV_NAME-HASH-py3.9/bin/python

poetry run ipython kernel install --name=ENV_NAME
>Installed kernelspec ENV_NAME in /Users/myusername/Library/Jupyter/kernels/ENV_NAME

Then if I open a Jupyter with this kernel I don't get the libraries that should be installed. Checking the Python version I get:

!which python
/Users/myusername/opt/anaconda3/bin/python

Any help appreaciated!

1 Answers

did you try to activate your environement first ? (using source {path to env}/bin/activate ? if so, can you try installing the ipykernel directly : poetry run python -m ipykernel install --user --name myname

Related