Is there a way to get IJulia to work with a poetry environment?

I have a local Poetry .venv with Jupyter already installed. I am trying to get IJulia to work with this Jupyter installation as opposed to installing it through Conda. But I am not having much success.

This is what I've tried so far:

$ poetry shell
$ julia
julia> ]
pkg> activate MyEnv
julia> ENV["JUPYTER"]=".venv/bin/jupyter"
julia> ]
pkg> add IJulia
julia> using IJulia
julia> notebook()

Then it still asks me if I want to install Jupyter with Conda. And I do not. What am I missing here?


  • I tested on Ubuntu running on WSL2 and the following works for me.

    1. Have poetry along jupyter installed

    2. Check that whereis python resolves to poetry Python installation

    3. Start Julia:

       $ poetry shell
       $ julia
    4. Run the following code:

       using Pkg
       pyt = split(read(`whereis python`, String))[2]
    5. Now you are done so you can do:

       julia> ENV["JUPYTER_TOKEN"]="mysecret";  # Jupyter password
       julia>  notebook(dir=".")
       [ Info: running `/home/ubuntu/.cache/pypoetry/virtualenvs/ubuntu-zk_aSFMD-py3.10/bin/jupyter notebook`

    Here is my installation:

    enter image description here