Help debugging problem with Pluto notebook

Hi. I have a notebook that used to work without problems. I don’t know if my problems stem from my notebook or from a change in Pluto or the other loaded packages. Strangely, the notebook hangs when first launched at 12 of 27 cells and then, if I click on the Pluto icon and then click on the x next to the notebook name and then click again to relaunch, it loads successfully. I haven’t gutted the notebook to create a MWE yet but I hope the info below allows someone to point me in the right direction…

My setup:

Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M1 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
Environment:
  JULIA_NUM_THREADS = auto
  JULIA_EDITOR = Visual Studio Code

My packages (myFuncs is a local module):

import Pkg
Pkg.activate()
using Plots, PlutoUI, BenchmarkTools, DataFrames, Dates,  Revise, myFuncs

Package versions:

 [6e4b80f9] BenchmarkTools v1.5.0
 [a93c6f00] DataFrames v1.7.0
 [91a5bcdd] Plots v1.40.9
 [c3e4b0f8] Pluto v0.20.3
 [7f904dfe] PlutoUI v0.7.60
 [295af30f] Revise v3.6.4
 [ade2ca70] Dates v1.11.0

The error I get:

julia> using Pluto; Pluto.run()
[ Info: Loading...
┌ Info:
└ Opening http://localhost:1234/?secret=iK4OPKpS in your default browser... ~ have fun!
┌ Info:
│ Press Ctrl+C in this terminal to stop Pluto
└
schedule: Task not runnable
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] enq_work(t::Task)
    @ Base ./task.jl:792
  [3] schedule
    @ ./task.jl:833 [inlined]
  [4] get_workspace(session_notebook::Tuple{Pluto.ServerSession, Pluto.Notebook}; allow_creation::Bool)
    @ Pluto.WorkspaceManager ~/.julia/packages/Pluto/esC4R/src/evaluation/WorkspaceManager.jl:342
  [5] get_workspace
    @ ~/.julia/packages/Pluto/esC4R/src/evaluation/WorkspaceManager.jl:326 [inlined]
  [6] bump_workspace_module(session_notebook::Tuple{Pluto.ServerSession, Pluto.Notebook})
    @ Pluto.WorkspaceManager ~/.julia/packages/Pluto/esC4R/src/evaluation/WorkspaceManager.jl:252
  [7] run_reactive_core!(session::Pluto.ServerSession, notebook::Pluto.Notebook, old_topology::PlutoDependencyExplorer.NotebookTopology{Pluto.Cell}, new_topology::PlutoDependencyExplorer.NotebookTopology{Pluto.Cell}, roots::Vector{Pluto.Cell}; save::Bool, deletion_hook::typeof(Pluto.WorkspaceManager.move_vars), user_requested_run::Bool, already_run::Vector{Pluto.Cell}, bond_value_pairs::Base.Iterators.Zip{Tuple{Vector{Symbol}, Vector{Any}}})
    @ Pluto ~/.julia/packages/Pluto/esC4R/src/evaluation/Run.jl:58
  [8] (::Pluto.var"#240#246"{Bool, @Kwargs{}, Pluto.ServerSession, Pluto.Notebook})()
    @ Pluto ~/.julia/packages/Pluto/esC4R/src/evaluation/Run.jl:481
  [9] withtoken(f::Pluto.var"#240#246"{Bool, @Kwargs{}, Pluto.ServerSession, Pluto.Notebook}, token::Pluto.Token)
    @ Pluto ~/.julia/packages/Pluto/esC4R/src/evaluation/Tokens.jl:19
 [10] #239
    @ ~/.julia/packages/Pluto/esC4R/src/evaluation/Run.jl:457 [inlined]
 [11] (::Pluto.var"#231#232"{Pluto.var"#239#245"{Bool, @Kwargs{}, Pluto.ServerSession, Pluto.Notebook}})()
    @ Pluto ~/.julia/packages/Pluto/esC4R/src/evaluation/Tokens.jl:58

Thoughts?

1 Like

Did you create a task and schedule it somewhere in the notebook? If a task that’s already done gets scheduled again somehow, you might get Task not runnable. Just a guess. It’s hard to say without seeing more code.

I didn’t create and schedule a task…

And I understand that it’s really not possible to diagnose w/o seeing the notebook if it’s not an obvious problem. I was hoping that someone more knowledgeable might be able to glean more from the error message than I have.

Were you able to fix this issue? I am also facing this issue for some days now. It started appearing after I updated to julia 1.11.2, but I havent been able to fix this by going back to 1.11.1 or even 1.10.7. Also I tried different versions of Pluto itself which also did not fix this issue.

I’m not sure whether this is related but I have only faced this with a notebook where I turn off Pluto Pkg management using the cell:

let
    using Pkg
    Pkg.activate(Base.current_project())
    Pkg.status()
end

Other details:

The error:

schedule: Task not runnable
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] enq_work(t::Task)
    @ Base ./task.jl:792
  [3] schedule
    @ ./task.jl:833 [inlined]
  [4] #get_workspace#13
    @ ~/.julia/packages/Pluto/esC4R/src/evaluation/WorkspaceManager.jl:342
  [5] get_workspace
    @ ~/.julia/packages/Pluto/esC4R/src/evaluation/WorkspaceManager.jl:326 [inlined]
  [6] bump_workspace_module
    @ ~/.julia/packages/Pluto/esC4R/src/evaluation/WorkspaceManager.jl:252
  [7] run_reactive_core!(session::Pluto.ServerSession, notebook::Pluto.Notebook, old_topology::PlutoDependencyExplorer.NotebookTopology{Pluto.Cell}, new_topology::PlutoDependencyExplore
r.NotebookTopology{Pluto.Cell}, roots::Vector{Pluto.Cell}; save::Bool, deletion_hook::typeof(Pluto.WorkspaceManager.move_vars), user_requested_run::Bool, already_run::Vector{Pluto.Cell}
, bond_value_pairs::Base.Iterators.Zip{Tuple{Vector{Symbol}, Vector{Any}}})
    @ Pluto ~/.julia/packages/Pluto/esC4R/src/evaluation/Run.jl:58
  [8] (::Pluto.var"#240#246"{Bool, @Kwargs{}, Pluto.ServerSession, Pluto.Notebook})()
    @ Pluto ~/.julia/packages/Pluto/esC4R/src/evaluation/Run.jl:481
  [9] withtoken(f::Pluto.var"#240#246"{Bool, @Kwargs{}, Pluto.ServerSession, Pluto.Notebook}, token::Pluto.Token)
    @ Pluto ~/.julia/packages/Pluto/esC4R/src/evaluation/Tokens.jl:19
 [10] #239
    @ ~/.julia/packages/Pluto/esC4R/src/evaluation/Run.jl:457 [inlined]
 [11] (::Pluto.var"#231#232"{Pluto.var"#239#245"{Bool, @Kwargs{}, Pluto.ServerSession, Pluto.Notebook}})()
    @ Pluto ~/.julia/packages/Pluto/esC4R/src/evaluation/Tokens.jl:58

Versions:

julia> versioninfo()
Julia Version 1.11.2
Commit 5e9a32e7af2 (2024-12-01 20:02 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 24 × Intel(R) Xeon(R) W-3235 CPU @ 3.30GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, cascadelake)
Threads: 16 default, 0 interactive, 8 GC (on 24 virtual cores)
Environment:
  LD_LIBRARY_PATH = /apps/rashid/Apps/mambaforge/lib:
  JULIA_NUM_THREADS = 16
  JULIA_PKG_DEVDIR = /apps/rashid/MyGitProjects
  JULIA_NUM_PRECOMPILE_TASKS = 6

(@v1.11) pkg> status Pluto
Status `~/.julia/environments/v1.11/Project.toml`
  [c3e4b0f8] Pluto v0.20.3
1 Like

Issue created here: Error when opening notebook file: `schedule: Task not runnable` · Issue #3114 · fonsp/Pluto.jl · GitHub

I was not able to fix it. No idea how to proceed :<

Were you also turning off Pluto Pkg management by doing Pkg.activate like what I am doing?

yes. i’m investigating the (very ugly) alternative of simply adding another giant cell containing all the functions in my local module, and then using pluto package management as usual. i hate to do that for all the obvious reasons, but it may isolate the problem and make the notebook work.

Ok, here’s the ugly fix that worked for me: Create a yourModuleNameFunctions.jl file with the contents of your local module or package, i.e. make yourModuleNameFunctions.jl look like this

#=
module yourModuleName

using  thePackagesYourModuleNeeds

export yourFunction1, yourFunction2, ...
=#
function yourFunction1(...
...
end
...
#end # of yourModuleName

Now get rid of the Pkg.activate statement and add whatever packages you’ve commented out to the using statement in your Pluto notebook and (on a following line) do import("yourModuleNameFunctions.jl")

That’s it. Works for me. Please let me know if it fixes your issue also, as that makes it more likely that it’s a generally useful kludge :smiley:

1 Like

Nice workaround. But I actually can’t get rid of Pkg.activate as I am using several locally developing packages which are deved in my local project.

Hopefully this will get fixed soon if some Pluto developer takes a look at the issue I have created in github.

if the problem persists then you could always import each of your locally dev’d packages as per the workaround above. ugly and not generic, but the notebook would work fine.

also, it’s trivial but perhaps still worth noting that, in order to make it easy to recover once the issue is fixed properly, what i do is just take the usual cell

begin
    using Pkg
    Pkg.activate(Base.current_project())
    Pkg.status()
end

and comment it out

begin
    #=
    using Pkg
    Pkg.activate(Base.current_project())
    Pkg.status()
    =#
end

and add a new cell

begin
    using PkgName1, PkgName2, ...
    import("current_project_functions.jl")
end

that way i can go back and forth between the proper way and the kludge with minimal editing.