Running lates MAC OS. When I try to use PyPlot I get this
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.0 (2022-08-17)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using PyPlot
ERROR: InitError: UndefVarError: IJulia not defined
Stacktrace:
[1] __init__()
@ PyCall ~/.julia/packages/PyCall/g5hlI/src/pyinit.jl:260
[2] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
@ Base ./loading.jl:831
[3] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, sourcepath::String, depmods::Vector{Any})
@ Base ./loading.jl:938
[4] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
@ Base ./loading.jl:1028
[5] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1315
[6] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[7] macro expansion
@ ./loading.jl:1180 [inlined]
[8] macro expansion
@ ./lock.jl:223 [inlined]
[9] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144
during initialization of module PyCall
but when I do using PyPlot
immediately afterwards it works fine. Any idea what is happening?
I have tried updating all packages, rebuilding IJulia, PyPlot, PyCall … with no luck.
I’ve been having using IJulia
in my startup.jl file forever. When I take it out this problem goes away. Why?
Just tried rebuilding my .julia directory from scratch. Problem is still here.
Palli
August 22, 2022, 2:57pm
3
Which version are you using, or just do, to see if anything is holding you back from latest version:
(@v1.9) pkg> add IJulia@1.23.3
PyCall (and PyPlot) have some logic for IJulia:
https://github.com/JuliaPy/PyCall.jl/blob/2728e20162db3c90198e2828c40e675924c73528/src/pyinit.jl#L260
What’s the difference between IJulia.jl and IPython.jl? I was trying to dig into this and by accident looked into the latter, and installing got a downgrade:
[18364772] + IPython v0.5.1
Updating `~/.julia/environments/v1.9/Manifest.toml`
⌅ [34da2185] ↓ Compat v4.2.0 ⇒ v3.46.0
It needs a compat entry for 4.0. Maybe something similar is happening for IJulia, and holding you back because you use some other package?
I think my IJulia is up to date.
(@v1.8) pkg> add IJulia@1.23.3
Updating registry at `~/.julia/registries/General.toml`
Resolving package versions...
No Changes to `~/.julia/environments/v1.8/Project.toml`
No Changes to `~/.julia/environments/v1.8/Manifest.toml`
On an M1 Macbook things work, but I get this everytime
julia> using PyPlot
[ Info: Installing matplotlib via the Conda matplotlib package...
[ Info: Running `conda install -y matplotlib` in root environment
Collecting package metadata (current_repodata.json): done
Solving environment: done
# All requested packages already installed.
Retrieving notices: ...working... done
Why does conda install
run everytime?
I just pushed a bugfix. Should be tagged shortly, at which point you can do a package update: https://github.com/JuliaRegistries/General/pull/66764
1 Like
Things work in the repl if I put
using PyPlot
using IJulia
in my startup.jl file. If I swap the order I get the error message as when Julia starts up.
However, when I do that my notebooks can’t find the kernel.
After rebuilding .julia for the third time I found that using TerminalPager
in my startup file seemed to be the problem.
I doubt it; probably you updated to the PyCall version that I just registered without noticing.
2 Likes
IJulia is to install a Jupyter kernel that runs julia. IPython is to use Python from within the Julia REPL.