Skip to content

poetry-kernel uses Jupyter env instead of notebook env #7

Open

Description

@drakesiardxy

If a poetry pyproject.toml is used to create the environment for the Jupyter lab (adding poetry-kernel as a dependency), then no matter in which working directory the jupyter server is started, any notebook that is opened with the "poetry" kernel will have the Jupyter environment, not the environment of the notebook's project.

Minimal example: https://github.com/drakesiardxy/poetry-kernel-bug
To replicate: Create the jupyer-base env and the kernel_a env separately, then start the jupyter server with the first environment and attempt to run kernel_a.ipynb using the "Poetry" kernel. pandas will be missing, because the notebook will have been launched with the environment of the server, not the environment belonging to the notebook's project.

Activity

  1. bluss commented on Jun 20, 2023

    @bluss

    Would be very powerful if poetry had a flag or some way to avoid this. My fork that uses rye for a kernel in the same way, it handles the environment "nesting" fine.

    Edit: Poetry doesn't need a flag - but maybe that you create the environment for the nested project explicitly. After that, nested poetry run works fine.

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

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