Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyPlot won't compile with latest nightly #52029

Closed
ctkelley opened this issue Nov 4, 2023 · 6 comments
Closed

PyPlot won't compile with latest nightly #52029

ctkelley opened this issue Nov 4, 2023 · 6 comments

Comments

@ctkelley
Copy link

ctkelley commented Nov 4, 2023

PyPlot will not compile with the latest nightly.

M2 MACbook Air + latest OS

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0-DEV.840 (2023-11-04)
 _/ |\__'_|_|_|\__'_|  |  Commit 9e7516142d8 (0 days old master)
|__/                   |

julia> using PyPlot
┌ Info: Precompiling PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee]
└ @ Base loading.jl:2442
ERROR: LoadError: ArgumentError: Source type for `reinterpret` must be isbits
Stacktrace:
  [1] _reinterpret
    @ Base ./reinterpretarray.jl:803 [inlined]
  [2] reinterpret(::Type{UInt8}, x::MemoryRef{Int32})
    @ Base ./essentials.jl:608
  [3] _preserveas!(dest::Vector{UInt8}, ::Type{Cwstring}, x::String)
    @ PyCall ~/.julia/packages/PyCall/ilqDX/deps/depsutils.jl:67
  [4] Py_SetPythonHome(libpy::Ptr{Nothing}, pyversion::VersionNumber, PYTHONHOME::String)
    @ PyCall ~/.julia/packages/PyCall/ilqDX/deps/depsutils.jl:36
  [5] top-level scope
    @ ~/.julia/packages/PyCall/ilqDX/src/startup.jl:57
  [6] include(mod::Module, _path::String)
    @ Base ./Base.jl:523
  [7] include(x::String)
    @ PyCall ~/.julia/packages/PyCall/ilqDX/src/PyCall.jl:1
  [8] top-level scope
    @ ~/.julia/packages/PyCall/ilqDX/src/PyCall.jl:38
  [9] include
    @ Base ./Base.jl:523 [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:2311
 [11] top-level scope
    @ stdin:3
in expression starting at /Users/ctk/.julia/packages/PyCall/ilqDX/src/startup.jl:41
in expression starting at /Users/ctk/.julia/packages/PyCall/ilqDX/src/PyCall.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to "/Users/ctk/.julia/compiled/v1.11/PyCall/jl_BxehXF".
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)
    @ Base ./loading.jl:2557
  [3] compilecache
    @ Base ./loading.jl:2429 [inlined]
  [4] (::Base.var"#1026#1027"{Base.PkgId})()
    @ Base ./loading.jl:2031
  [5] mkpidlock(f::Base.var"#1026#1027"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:95
  [6] #mkpidlock#6
    @ FileWatching.Pidfile /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:90 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:116
  [8] #invokelatest#2
    @ Base ./essentials.jl:931 [inlined]
  [9] invokelatest
    @ Base ./essentials.jl:926 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#1026#1027"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base ./loading.jl:3137
 [11] maybe_cachefile_lock
    @ Base ./loading.jl:3134 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2027
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1872
 [14] #invoke_in_world#3
    @ Base ./essentials.jl:963 [inlined]
 [15] invoke_in_world
    @ Base ./essentials.jl:960 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1863
 [17] macro expansion
    @ Base ./loading.jl:1801 [inlined]
 [18] macro expansion
    @ Base ./lock.jl:267 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1762
 [20] #invoke_in_world#3
    @ Base ./essentials.jl:963 [inlined]
 [21] invoke_in_world
    @ Base ./essentials.jl:960 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1755
 [23] include
    @ Base ./Base.jl:523 [inlined]
 [24] 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::Nothing)
    @ Base ./loading.jl:2311
 [25] top-level scope
    @ stdin:3
in expression starting at /Users/ctk/.julia/packages/PyPlot/2MlrT/src/PyPlot.jl:2
in expression starting at stdin:3
ERROR: Failed to precompile PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee] to "/Users/ctk/.julia/compiled/v1.11/PyPlot/jl_gnDaxs".
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)
    @ Base ./loading.jl:2557
  [3] compilecache
    @ Base ./loading.jl:2429 [inlined]
  [4] (::Base.var"#1026#1027"{Base.PkgId})()
    @ Base ./loading.jl:2031
  [5] mkpidlock(f::Base.var"#1026#1027"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:95
  [6] #mkpidlock#6
    @ FileWatching.Pidfile /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:90 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/FileWatching/src/pidfile.jl:116
  [8] #invokelatest#2
    @ Base ./essentials.jl:931 [inlined]
  [9] invokelatest
    @ Base ./essentials.jl:926 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#1026#1027"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base ./loading.jl:3137
 [11] maybe_cachefile_lock
    @ Base ./loading.jl:3134 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2027
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1872
 [14] #invoke_in_world#3
    @ Base ./essentials.jl:963 [inlined]
 [15] invoke_in_world
    @ Base ./essentials.jl:960 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1863
 [17] macro expansion
    @ Base ./loading.jl:1801 [inlined]
 [18] macro expansion
    @ Base ./lock.jl:267 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1762
 [20] #invoke_in_world#3
    @ Base ./essentials.jl:963 [inlined]
 [21] invoke_in_world
    @ Base ./essentials.jl:960 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1755
@ctkelley
Copy link
Author

ctkelley commented Nov 4, 2023

No problems with v1.10-rc1, so I think it's Julia issue and not a PyPlot issue.

@jakobnissen
Copy link
Contributor

This happens because Base.cconvert now returns a MemoryRef instead of Vector, and MemoryRef does not support reinterpret, so it is the following code that fails:
1.10-rc1:

julia> reinterpret(UInt8, Base.cconvert(Cwstring, "a"))
8-element reinterpret(UInt8, ::Vector{Int32}):
[...]

master:

julia> reinterpret(UInt8, Base.cconvert(Cwstring, "a"))
ERROR: ArgumentError: Source type for `reinterpret` must be isbits

I guess the solution here is for PyCall to not cconvert to a C type and then pass it into Julia functions rather than C functions. It might also make sense to define reinterpret for MemoryRef, perhaps.

@jakobnissen
Copy link
Contributor

Already fixed downstream: JuliaPy/PyCall.jl#1059

@ctkelley
Copy link
Author

ctkelley commented Nov 6, 2023 via email

@jakobnissen
Copy link
Contributor

The issue is with PyCall, a dependency of PyPlot. Until PyCall makes a new release, which will contain the bugfix, the issue will still be in PyPlot. It can't really be fixed from the Julia side

@ctkelley
Copy link
Author

ctkelley commented Nov 7, 2023

I see. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants