JuliaLang / IJulia.jl

Julia kernel for Jupyter
MIT License
2.78k stars 409 forks source link

Undefined reference when using `clear_output` #1066

Open MilesCranmer opened 1 year ago

MilesCranmer commented 1 year ago

Hey,

Not sure what this error is, but running clear_output inside a Jupyter notebook seems to result in an undefined reference error. MWE below.

  1. The output of versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65ea (2023-01-08 06:45 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.5.0)
  CPU: 8 × Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 6 on 6 virtual cores
  1. How you installed Julia

juliaup

  1. A minimal working example (MWE), also known as a minimum reproducible example

In a Jupyter notebook:

import IJulia: display, clear_output

display("text/html", "<h1>Test</h1>")
clear_output()
display("text/html", "<h1>Test</h1>")

produces the error:

UndefRefError: access to undefined reference

Stacktrace:
 [1] getproperty
   @ ./Base.jl:38 [inlined]
 [2] getindex
   @ ./refvalue.jl:56 [inlined]
 [3] clear_output(wait::Bool)
   @ IJulia ~/.julia/packages/IJulia/6TIq1/src/IJulia.jl:288
 [4] top-level scope
   @ ~/Documents/PySR/examples/test_progress_bars.ipynb:2

Confirmed this also happens with no output, and with wait set to true or false.


I am using the official Jupyter extension inside VSCode. This is version v2023.1.2010391206.

rtdietrich commented 1 year ago

I have the same problem and hope it will be fixed soon

VSCode

OS: Windows (x86_64-w64-mingw32) CPU: 32 × AMD Ryzen 9 7950X 16-Core Processor WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, znver3) Threads: 32 on 32 virtual cores Environment: JULIA_EDITOR = code.cmd -g

Try to run this:


using Rocket, Compose, IJulia ; set_default_graphic_size(35cm, 2cm)

function draw_ball(t)
    IJulia.clear_output(true)
    x = -exp(-0.01t) + 1                     # x coordinate
    y = -abs(exp(-0.04t)*(cos(0.1t))) + 0.83 # y coordinate
    display(compose(context(), circle(x, y, 0.01)))
end

source = interval(20) |> take(200) # Take only first 200 emissions

subscription = subscribe!(source, draw_ball)```

sleep(5)