JuliaPy / PyPlot.jl

Plotting for Julia based on matplotlib.pyplot
https://github.com/JuliaPy/PyPlot.jl
MIT License
469 stars 85 forks source link

__version__ not found when using PyPlot #553

Closed samuelkim314 closed 1 year ago

samuelkim314 commented 1 year ago

I have no issues using PyPlot on linux, but when I tried to use it on Windows, I get the below error. I'm not sure whether this relates to my Python installation or if it's something specific to 'PyPlot. I am able to import matplotlib in Python just fine.

ERROR: InitError: KeyError: key :__version__ not found
Stacktrace:
  [1] __getproperty(o::PyCall.PyObject, s::Symbol)
    @ PyCall C:\Users\Sam\.julia\packages\PyCall\7a7w0\src\PyCall.jl:307   
  [2] getproperty
    @ C:\Users\Sam\.julia\packages\PyCall\7a7w0\src\PyCall.jl:312 [inlined]
  [3] __init__()
    @ PyPlot C:\Users\Sam\.julia\packages\PyPlot\XaELc\src\init.jl:186     
  [4] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base .\loading.jl:696
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String) 
    @ Base .\loading.jl:782
  [6] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1020
  [7] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:936
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:923
  [9] eval
    @ .\boot.jl:360 [inlined]
 [10] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
    @ Base .\loading.jl:1116
 [11] include_string(m::Module, txt::String, fname::String)
    @ Base .\loading.jl:1126
 [12] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base .\essentials.jl:708
 [13] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N)
    @ Base .\essentials.jl:706
 [14] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
    @ VSCodeServer c:\Users\Sam\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:211
 [15] (::VSCodeServer.var"#63#67"{Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\Sam\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:155
 [16] withpath(f::VSCodeServer.var"#63#67"{Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
    @ VSCodeServer c:\Users\Sam\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\repl.jl:184
 [17] (::VSCodeServer.var"#62#66"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\Sam\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:153
 [18] hideprompt(f::VSCodeServer.var"#62#66"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
    @ VSCodeServer c:\Users\Sam\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\repl.jl:36
 [19] (::VSCodeServer.var"#61#65"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\Sam\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:124
 [20] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:491
 [21] with_logger
    @ .\logging.jl:603 [inlined]
 [22] (::VSCodeServer.var"#60#64"{VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\Sam\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:201
 [23] #invokelatest#2
    @ .\essentials.jl:708 [inlined]
 [24] invokelatest(::Any)
    @ Base .\essentials.jl:706
 [25] macro expansion
    @ c:\Users\Sam\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
 [26] (::VSCodeServer.var"#58#59")()
    @ VSCodeServer .\task.jl:411
during initialization of module PyPlot
stevengj commented 1 year ago

What Python installation are you using?

samuelkim314 commented 1 year ago

I am using the base conda environment, so my python path is C:\Users\Sam\miniconda3\python.exe

samuelkim314 commented 1 year ago

I'm not sure what happened, but I set ENV["PYTHON"]="", deleted the folder .julia/packages/Conda, and built PyCall/Conda, and now it ran fine. It wasn't working previously when I set ENV["PYTHON"]="" without deleting the Conda folder, so I'm guessing there was some setting that wasn't getting updated properly when rebuilding.