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

Compose.Table raises unexpected error on 32-bit Linux #382

Open
ben-schulz opened this issue Jan 20, 2020 · 12 comments
Open

Compose.Table raises unexpected error on 32-bit Linux #382

ben-schulz opened this issue Jan 20, 2020 · 12 comments

Comments

@ben-schulz
Copy link

when building the docs for Gadfly.jl using v1.3.1 of the 32-bit Julia binary for Linux, i get the following error:

MethodError: no method matching Compose.Table(::Int32, ::Int64, ::UnitRange{Int32}, ::UnitRange{Int64}; x_prop=[1.0, 1.0, 1.0], y_prop=[1.0], fixed_configs=Any[Tuple{Int32,Int32}[(1, 1)], Tuple{Int32,Int32}[(1, 2)], Tuple{Int32,Int64}[(2, 3), (2, 4), (2, 5)], Tuple{Int32,Int64}[(3, 3), (3, 4), (3, 5)]])

steps to reproduce:

git clone [email protected]:GiovineItalia/Gadfly.jl.git

cd Gadfly.jl

rm -Rf ~/.julia/*     # clean local packages

julia -e 'using Pkg; Pkg.add(PackageSpec(name="Compose", rev="master"))'
julia --color=yes --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' && julia --color=yes --project=docs docs/make.jl

full stack trace:

ERROR: LoadError: MethodError: no method matching Compose.Table(::Int32, ::Int64, ::UnitRange{Int32}, ::UnitRange{Int64}; x_prop=[1.0, 1.0, 1.0], y_prop=[1.0], fixed_configs=Any[Tuple{Int32,Int32}[(1, 1)], Tuple{Int32,Int32}[(1, 2)], Tuple{Int32,Int64}[(2, 3), (2, 4), (2, 5)], Tuple{Int32,Int64}[(3, 3), (3, 4), (3, 5)]])
Closest candidates are:
  Compose.Table(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any) at /home/slowpoke/.julia/packages/Compose/aVZwV/src/table.jl:7 got unsupported keyword arguments "x_prop", "y_prop", "fixed_configs"
  Compose.Table(::Integer, ::Integer, ::UnitRange{Int32}, ::UnitRange{Int32}; y_prop, x_prop, aspect_ratio, units, order, withjs, withoutjs, fixed_configs) at /home/slowpoke/.julia/packages/Compose/aVZwV/src/table.jl:46
  Compose.Table(::Array{Array{Context,1},2}, ::UnitRange{Int32}, ::UnitRange{Int32}, ::Union{Nothing, Array{Float64,1}}, ::Union{Nothing, Array{Float64,1}}, ::Union{Nothing, Float64}, ::Array{T,1} where T, ::Union{Nothing, UnitBox}, ::Int32, ::Bool, ::Bool) at /home/slowpoke/.julia/packages/Compose/aVZwV/src/table.jl:7 got unsupported keyword arguments "x_prop", "y_prop", "fixed_configs"
Stacktrace:
 [1] render(::Gadfly.Geom.SubplotGrid, ::Theme, ::Gadfly.Aesthetics, ::Array{Gadfly.Aesthetics,1}, ::Array{Gadfly.Data,1}, ::Dict{Symbol,Gadfly.ScaleElement}) at /home/slowpoke/sandbox/Gadfly.jl/src/geom/subplot.jl:262
 [2] (::Gadfly.var"#108#109"{Dict{Symbol,Gadfly.ScaleElement}})(::Tuple{Layer,Gadfly.Aesthetics,Array{Gadfly.Aesthetics,1},Array{Gadfly.Data,1},Theme}) at ./none:0
 [3] collect(::Base.Generator{Base.Iterators.Zip{Tuple{Array{Layer,1},Array{Gadfly.Aesthetics,1},Array{Array{Gadfly.Aesthetics,1},1},Array{Array{Gadfly.Data,1},1},Array{Theme,1}}},Gadfly.var"#108#109"{Dict{Symbol,Gadfly.ScaleElement}}}) at ./generator.jl:47
 [4] #render_prepared#107(::Bool, ::Bool, ::typeof(Gadfly.render_prepared), ::Plot, ::Gadfly.Coord.SubplotGrid, ::Gadfly.Aesthetics, ::Array{Gadfly.Aesthetics,1}, ::Array{Array{Gadfly.StatisticElement,1},1}, ::Array{Array{Gadfly.Aesthetics,1},1}, ::Array{Array{Gadfly.Data,1},1}, ::Dict{Symbol,Gadfly.ScaleElement}, ::Array{Gadfly.GuideElement,1}) at /home/slowpoke/sandbox/Gadfly.jl/src/Gadfly.jl:824
 [5] render_prepared(::Plot, ::Gadfly.Coord.SubplotGrid, ::Gadfly.Aesthetics, ::Array{Gadfly.Aesthetics,1}, ::Array{Array{Gadfly.StatisticElement,1},1}, ::Array{Array{Gadfly.Aesthetics,1},1}, ::Array{Array{Gadfly.Data,1},1}, ::Dict{Symbol,Gadfly.ScaleElement}, ::Array{Gadfly.GuideElement,1}) at /home/slowpoke/sandbox/Gadfly.jl/src/Gadfly.jl:813
 [6] render(::Plot) at /home/slowpoke/sandbox/Gadfly.jl/src/Gadfly.jl:759
 [7] draw at /home/slowpoke/sandbox/Gadfly.jl/src/Gadfly.jl:864 [inlined]
 [8] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plot) at /home/slowpoke/sandbox/Gadfly.jl/src/Gadfly.jl:954
 [9] __binrepr at ./multimedia.jl:157 [inlined]
 [10] _textrepr at ./multimedia.jl:149 [inlined]
 [11] #stringmime#6(::Nothing, ::typeof(Base64.stringmime), ::MIME{Symbol("text/html")}, ::Plot) at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.3/Base64/src/Base64.jl:43
 [12] stringmime(::MIME{Symbol("text/html")}, ::Plot) at /buildworker/worker/package_linux32/build/usr/share/julia/stdlib/v1.3/Base64/src/Base64.jl:43
 [13] display_dict(::Plot) at /home/slowpoke/.julia/packages/Documenter/Eayks/src/Utilities/Utilities.jl:652
 [14] #invokelatest#1 at ./essentials.jl:709 [inlined]
 [15] invokelatest at ./essentials.jl:708 [inlined]
 [16] runner(::Type{Documenter.Expanders.ExampleBlocks}, ::Markdown.Code, ::Documenter.Documents.Page, ::Documenter.Documents.Document) at /home/slowpoke/.julia/packages/Documenter/Eayks/src/Expanders.jl:571
 [17] dispatch(::Type{Documenter.Expanders.ExpanderPipeline}, ::Markdown.Code, ::Vararg{Any,N} where N) at /home/slowpoke/.julia/packages/Documenter/Eayks/src/Utilities/Selectors.jl:167
 [18] expand(::Documenter.Documents.Document) at /home/slowpoke/.julia/packages/Documenter/Eayks/src/Expanders.jl:30
 [19] runner(::Type{Documenter.Builder.ExpandTemplates}, ::Documenter.Documents.Document) at /home/slowpoke/.julia/packages/Documenter/Eayks/src/Builder.jl:179
 [20] dispatch(::Type{Documenter.Builder.DocumentPipeline}, ::Documenter.Documents.Document) at /home/slowpoke/.julia/packages/Documenter/Eayks/src/Utilities/Selectors.jl:167
 [21] #3 at /home/slowpoke/.julia/packages/Documenter/Eayks/src/Documenter.jl:287 [inlined]
 [22] cd(::Documenter.var"#3#8"{Documenter.Documents.Document}, ::String) at ./file.jl:104
 [23] #makedocs#1(::Bool, ::Documenter.Writers.HTMLWriter.HTML, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Nothing, ::Base.Iterators.Pairs{Symbol,Any,NTuple{4,Symbol},NamedTuple{(:modules, :clean, :sitename, :pages),Tuple{Array{Module,1},Bool,String,Array{Any,1}}}}, ::typeof(makedocs)) at /home/slowpoke/.julia/packages/Documenter/Eayks/src/Documenter.jl:286
 [24] (::Documenter.var"#kw##makedocs")(::NamedTuple{(:modules, :clean, :sitename, :pages),Tuple{Array{Module,1},Bool,String,Array{Any,1}}}, ::typeof(makedocs)) at ./none:0
 [25] top-level scope at /home/slowpoke/sandbox/Gadfly.jl/docs/make.jl:3
 [26] include at ./boot.jl:328 [inlined]
 [27] include_relative(::Module, ::String) at ./loading.jl:1105
 [28] include(::Module, ::String) at ./Base.jl:31
 [29] exec_options(::Base.JLOptions) at ./client.jl:287
 [30] _start() at ./cliendt.jl:460
in expression starting at /home/slowpoke/sandbox/Gadfly.jl/docs/make.jl:3

(originally referenced in: GiovineItalia/Gadfly.jl#1374 (comment))

@kimikage
Copy link

Perhaps the possible fixes are in three layers.

  1. User input (i.e. script in "docs")
  2. Gadfly.jl (i.e. callers of Table)
  3. Compose.jl (e.g. Table(m::Integer, n::Integer, y_focus::UnitRange{<:Integer}, x_focus::UnitRange{<:Integer}; ...)

Considering the compatibility with (earlier) Compose.jl, it seems better to take 1. or 2. first.

@Mattriks
Copy link
Member

Mattriks commented Jan 20, 2020

Here's a simple "Compose-only" example on a 64-bit system:

x_focus = UnitRange{Int32}(1:3)
y_focus = UnitRange{Int32}(1:1)
Compose.Table(3,1, x_focus, y_focus, x_prop=ones(Float32,3), y_prop=ones(Float32,1))

MethodError: no method matching Compose.Table(::Int64, ::Int64, ::UnitRange{Int32}, ::UnitRange{Int32}; x_prop=Float32[1.0, 1.0, 1.0], y_prop=Float32[1.0])

I'd say this is a bug that's been introduced when upgrading Compose, so point 3 above is the solution for Compose.

@kimikage
Copy link

FWIW, "git blame" says this is a potential issue from the beginning. Of course, I think modifying Compose.jl is fine.

@Mattriks
Copy link
Member

Mattriks commented Jan 20, 2020

Wondering what the root cause is here in the 32-bit Gadfly example above. E.g. is Gadfly or one of it's dependencies mistakenly forcing Int64 (giving rise to UnitRange{Int64}) when it should be using Int. The suspect UnitRange "values" originate in this line, so e.g. what is the Integer type of a length of an empty or non-empty DefaultDict?

@kimikage
Copy link

This is a topic of Gadfly, not Compose, but I guess DefaultDict is innocent.
I think the problematic call of table is here:
https://github.com/GiovineItalia/Gadfly.jl/blob/aec6dad99a4780fb61e409c5b5a591b66c4b728b/src/geom/subplot.jl#L252-L269

@Mattriks
Copy link
Member

I think this line in Gadfly is the issue, because that's where the xgroup field in the aes struct gets created. That seems more of a bug than ::UnitRange{Int} in Compose.

@kimikage
Copy link

kimikage commented Jan 20, 2020

Your point seems to be correct.:+1:
However, it seems to have been changed to Int64 for some intent. I don't know the intent, though.
GiovineItalia/Gadfly.jl#1129
GiovineItalia/Gadfly.jl@1bfe856

@bjarthur
Copy link
Member

bjarthur commented Feb 2, 2020

@andreasnoack your change of Int to Int64 (see comment above) breaks Gadfly on 32-bit systems. can you explain why this was needed?

@andreasnoack
Copy link

Unfortunately, I don't remember why I made that change and I agree that it looks wrong to use Int64 instead of Int.

@Mattriks
Copy link
Member

Mattriks commented Feb 2, 2020

The index of a IndirectArray should always be an integer:

data = Gadfly.Data(shape=["A","A", "B", "C","C"])
scale = Scale.shape_discrete()
disc_data = Scale.discretize(getfield(data, :shape), scale.levels, scale.order)
disc_data.index # are integers

Can test to see if removing the Int() here causes any errors in Gadfly.

@Mattriks
Copy link
Member

The problem line above got changed in GiovineItalia/Gadfly.jl#1411, so I assume the OP is fixed.

@bjarthur
Copy link
Member

@ben-schulz can you test if this now works on master?

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

5 participants