GLMakie does not seem to compile in a notebook in cursor

I am trying to use GLMakie in a notebook in cursor but when I run

using GLMakie

it gives me a load error

ERROR: LoadError: UndefVarError: `px_per_unit` not defined in `Makie`
Suggestion: check for spelling errors or missing imports.
Stacktrace:
  [1] getproperty(x::Module, f::Symbol)
    @ Base ./Base.jl:42
  [2] top-level scope
    @ ~/.julia/packages/GLMakie/87u59/src/screen.jl:466
  [3] include(mod::Module, _path::String)
    @ Base ./Base.jl:557
  [4] include(x::String)
    @ GLMakie ~/.julia/packages/GLMakie/87u59/src/GLMakie.jl:1
  [5] top-level scope
    @ ~/.julia/packages/GLMakie/87u59/src/gl_backend.jl:75
  [6] include(mod::Module, _path::String)
    @ Base ./Base.jl:557
  [7] include(x::String)
    @ GLMakie ~/.julia/packages/GLMakie/87u59/src/GLMakie.jl:1
  [8] top-level scope
    @ ~/.julia/packages/GLMakie/87u59/src/GLMakie.jl:87
  [9] include
    @ ./Base.jl:557 [inlined]
 [10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::String)
    @ Base ./loading.jl:2881
 [11] top-level scope
    @ stdin:6
in expression starting at /Users/hsharsh/.julia/packages/GLMakie/87u59/src/screen.jl:466
in expression starting at /Users/hsharsh/.julia/packages/GLMakie/87u59/src/gl_backend.jl:75
in expression starting at /Users/hsharsh/.julia/packages/GLMakie/87u59/src/GLMakie.jl:1
in expression starting at stdin:6

Here is the stacktrace

Failed to precompile GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a] to "/Users/hsharsh/.julia/compiled/v1.11/GLMakie/jl_C4vjR5".

Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool; flags::Cmd, cacheflags::Base.CacheFlags, reasons::Dict{String, Int64}, loadable_exts::Nothing)
    @ Base ./loading.jl:3174
  [3] (::Base.var"#1110#1111"{Base.PkgId})()
    @ Base ./loading.jl:2579
  [4] mkpidlock(f::Base.var"#1110#1111"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.11.3+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:95
  [5] #mkpidlock#6
    @ ~/.julia/juliaup/julia-1.11.3+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:90 [inlined]
  [6] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.11.3+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:116
  [7] #invokelatest#2
    @ ./essentials.jl:1057 [inlined]
  [8] invokelatest
    @ ./essentials.jl:1052 [inlined]
  [9] maybe_cachefile_lock(f::Base.var"#1110#1111"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base ./loading.jl:3698
 [10] maybe_cachefile_lock
    @ ./loading.jl:3695 [inlined]
 [11] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2565
 [12] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2388
 [13] #invoke_in_world#3
    @ ./essentials.jl:1089 [inlined]
 [14] invoke_in_world
    @ ./essentials.jl:1086 [inlined]
 [15] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2375
 [16] macro expansion
    @ ./loading.jl:2314 [inlined]
 [17] macro expansion
    @ ./lock.jl:273 [inlined]
 [18] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2271
 [19] #invoke_in_world#3
    @ ./essentials.jl:1089 [inlined]
 [20] invoke_in_world
    @ ./essentials.jl:1086 [inlined]
 [21] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2260
 [22] eval
    @ ./boot.jl:430 [inlined]
 [23] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:2734
 [24] #invokelatest#2
    @ ./essentials.jl:1055 [inlined]
 [25] invokelatest
    @ ./essentials.jl:1052 [inlined]
 [26] (::VSCodeServer.var"#217#218"{VSCodeServer.NotebookRunCellArguments, String})()
    @ VSCodeServer ~/.cursor/extensions/julialang.language-julia-1.127.2/scripts/packages/VSCodeServer/src/serve_notebook.jl:24
 [27] withpath(f::VSCodeServer.var"#217#218"{VSCodeServer.NotebookRunCellArguments, String}, path::String)
    @ VSCodeServer ~/.cursor/extensions/julialang.language-julia-1.127.2/scripts/packages/VSCodeServer/src/repl.jl:276
 [28] notebook_runcell_request(conn::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, params::VSCodeServer.NotebookRunCellArguments)
    @ VSCodeServer ~/.cursor/extensions/julialang.language-julia-1.127.2/scripts/packages/VSCodeServer/src/serve_notebook.jl:13
 [29] dispatch_msg(x::VSCodeServer.JSONRPC.JSONRPCEndpoint{Base.PipeEndpoint, Base.PipeEndpoint}, dispatcher::VSCodeServer.JSONRPC.MsgDispatcher, msg::Dict{String, Any})
    @ VSCodeServer.JSONRPC ~/.cursor/extensions/julialang.language-julia-1.127.2/scripts/packages/JSONRPC/src/typed.jl:67
 [30] serve_notebook(pipename::String, debugger_pipename::String, outputchannel_logger::Base.CoreLogging.SimpleLogger; error_handler::var"#5#10"{String})
    @ VSCodeServer ~/.cursor/extensions/julialang.language-julia-1.127.2/scripts/packages/VSCodeServer/src/serve_notebook.jl:147
 [31] top-level scope
    @ ~/.cursor/extensions/julialang.language-julia-1.127.2/scripts/notebook/notebook.jl:35

When I run it in a terminal, it seems to work fine though.
Also, I am on a Apple Silicon Mac if that’s relevant.

that looks like a package environment issue… Make sure you’re in a clean package environment

1 Like