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

ERROR: LoadError: UndefVarError: pangolayout not defined #1206

Closed
CiaranOMara opened this issue Oct 10, 2018 · 17 comments · Fixed by GiovineItalia/Compose.jl#342
Closed

ERROR: LoadError: UndefVarError: pangolayout not defined #1206

CiaranOMara opened this issue Oct 10, 2018 · 17 comments · Fixed by GiovineItalia/Compose.jl#342

Comments

@CiaranOMara
Copy link
Contributor

I've encountered an error, "pangolayout not defined".

ERROR: LoadError: UndefVarError: pangolayout not defined
Stacktrace:
 [1] max_text_extents(::String, ::Float64, ::String) at /Users/username/.julia/packages/Compose/Mm12T/src/pango.jl:109
 [2] max_text_extents(::String, ::Measures.Length{:mm,Float64}, ::String) at /Users/username/.julia/packages/Compose/Mm12T/src/pango.jl:124
 [3] render(::Gadfly.Guide.Title, ::Theme, ::Gadfly.Aesthetics) at /Users/username/.julia/packages/Gadfly/7f45k/src/guide.jl:1055
 [4] render(::Gadfly.Guide.Title, ::Theme, ::Gadfly.Aesthetics, ::Bool) at /Users/username/.julia/packages/Gadfly/7f45k/src/guide.jl:141
 [5] #render_prepared#95(::Bool, ::Bool, ::Function, ::Plot, ::Gadfly.Coord.Cartesian, ::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 /Users/username/.julia/packages/Gadfly/7f45k/src/Gadfly.jl:821
 [6] render_prepared(::Plot, ::Gadfly.Coord.Cartesian, ::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 /Users/username/.julia/packages/Gadfly/7f45k/src/Gadfly.jl:801
 [7] render(::Plot) at /Users/username/.julia/packages/Gadfly/7f45k/src/Gadfly.jl:747
 [8] draw(::Compose.Image{Compose.PDFBackend}, ::Plot) at /Users/username/.julia/packages/Gadfly/7f45k/src/Gadfly.jl:852
 [9] top-level scope at none:0
 [10] include at ./boot.jl:317 [inlined]
 [11] include_relative(::Module, ::String) at ./loading.jl:1041
 [12] include(::Module, ::String) at ./sysimg.jl:29
 [13] exec_options(::Base.JLOptions) at ./client.jl:229
 [14] _start() at ./client.jl:421

I have the latest Cairo, Compose, and Gadfly.

  [0bcc2ff6]   Bedgraph v1.0.0
  [7fde5b66]   CachedDistributions v0.1.0 #develop (https://github.com/CiaranOMara/CachedDistributions.jl)
  [159f3aea] + Cairo v0.5.6+ #master (https://github.com/JuliaGraphics/Cairo.jl.git)
  [5ae59095]   Colors v0.9.4
  [a81c6b42] ~ Compose v0.7.0+ #master (https://github.com/GiovineItalia/Compose.jl.git)
  [186bb1d3] + Fontconfig v0.1.1+ #master (https://github.com/JuliaGraphics/Fontconfig.jl.git)
  [c91e804a] ~ Gadfly v0.8.0+ #master (https://github.com/GiovineItalia/Gadfly.jl.git)
  [d9be37ee] + Homebrew v0.7.0
  [095ffee8]   SampleHandler v0.1.0 #develop (https://github.com/CiaranOMara/SampleHandler.jl)
    Status `~/Projects/Plots.jl/Manifest.toml`
  [b99e7846] ↑ BinaryProvider v0.5.0 ⇒ v0.5.1
  [37cfa864] ↑ BioCore v2.0.2 ⇒ v2.0.4
  [19ecbf4d] + Codecs v0.5.0
  [a93c6f00] ↑ DataFrames v0.14.0 ⇒ v0.14.1
  [a2bd30eb] + Graphics v0.4.0
  [0862f596] + HTTPClient v0.2.1
  [a98d9a8b] ↑ Interpolations v0.9.1 ⇒ v0.10.3
  [c8e1da08] ↑ IterTools v1.0.0 ⇒ v1.1.0
  [b27032c2] + LibCURL v0.4.1
  [522f3ed2] + LibExpat v0.5.0
  [bd369af6] ↑ Tables v0.1.8 ⇒ v0.1.9
  [c17dfb99] + WinRPM v0.4.2
  [ddb6d928] + YAML v0.3.2

Does anyone know of a workaround?

@d9w
Copy link

d9w commented Oct 13, 2018

Seems like this is a known issue in Compose.jl relating to scopes:

The workaround proposed in the first issue still works, i.e. add a pangolayout definition to pango.jl (https://github.com/d9w/Compose.jl/commit/c2acf841a9faddd8785697c915f106a8b52ebd7d for an example)

@bjarthur
Copy link
Member

i'm working on fixing libpango in Compose. sorry it's taking so long.

@CiaranOMara
Copy link
Contributor Author

CiaranOMara commented Oct 13, 2018

@bjarthur, I had another look at the error after I received your message. Before the error, there is a warning that looks relevant to ccalls.

TypeError: in link_fontconfig, in ccall: first argument not a pointer or valid constant expression, expected Ptr, got Tuple{Symbol,String}

I have included the full output below.

[ Info: Loading Cairo backend into Compose.jl
[ Info: Loading Fontconfig backend into Compose.jl
┌ Warning: Error requiring Fontconfig from Compose:
│ TypeError: in link_fontconfig, in ccall: first argument not a pointer or valid constant expression, expected Ptr, got Tuple{Symbol,String}
│ Stacktrace:
│  [1] link_fontconfig() at ./logging.jl:309
│  [2] top-level scope at none:0
│  [3] eval at ./boot.jl:319 [inlined]
│  [4] eval at /Users/username/.julia/packages/Compose/qaXCu/src/Compose.jl:1 [inlined]
│  [5] (::getfield(Compose, Symbol("##114#120")))() at /Users/username/.julia/packages/Requires/9Jse8/src/require.jl:67
│  [6] err(::getfield(Compose, Symbol("##114#120")), ::Module, ::String) at /Users/username/.julia/packages/Requires/9Jse8/src/require.jl:38
│  [7] #113 at /Users/username/.julia/packages/Requires/9Jse8/src/require.jl:66 [inlined]
│  [8] withpath(::getfield(Compose, Symbol("##113#119")), ::String) at /Users/username/.julia/packages/Requires/9Jse8/src/require.jl:28
│  [9] (::getfield(Compose, Symbol("##112#118")))() at /Users/username/.julia/packages/Requires/9Jse8/src/require.jl:65
│  [10] #invokelatest#1 at ./essentials.jl:697 [inlined]
│  [11] invokelatest at ./essentials.jl:696 [inlined]
│  [12] #3 at /Users/username/.julia/packages/Requires/9Jse8/src/require.jl:19 [inlined]
│  [13] iterate at ./generator.jl:47 [inlined]
│  [14] _collect(::Array{Function,1}, ::Base.Generator{Array{Function,1},getfield(Requires, Symbol("##3#4"))}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at ./array.jl:632
│  [15] map at ./array.jl:561 [inlined]
│  [16] loadpkg(::Base.PkgId) at /Users/username/.julia/packages/Requires/9Jse8/src/require.jl:19
│  [17] #invokelatest#1 at ./essentials.jl:697 [inlined]
│  [18] invokelatest at ./essentials.jl:696 [inlined]
│  [19] require(::Base.PkgId) at ./loading.jl:858
│  [20] macro expansion at ./logging.jl:311 [inlined]
│  [21] require(::Module, ::Symbol) at ./loading.jl:837
│  [22] include at ./boot.jl:317 [inlined]
│  [23] include_relative(::Module, ::String) at ./loading.jl:1041
│  [24] include(::Module, ::String) at ./sysimg.jl:29
│  [25] exec_options(::Base.JLOptions) at ./client.jl:229
│  [26] _start() at ./client.jl:421
└ @ Requires ~/.julia/packages/Requires/9Jse8/src/require.jl:40
ERROR: LoadError: UndefVarError: pangolayout not defined
Stacktrace:
 [1] max_text_extents(::String, ::Float64, ::String) at /Users/username/.julia/packages/Compose/qaXCu/src/pango.jl:109
 [2] max_text_extents(::String, ::Measures.Length{:mm,Float64}, ::String) at /Users/username/.julia/packages/Compose/qaXCu/src/pango.jl:124
 [3] render(::Gadfly.Guide.Title, ::Theme, ::Gadfly.Aesthetics) at /Users/username/.julia/dev/Gadfly/src/guide.jl:1055
 [4] render(::Gadfly.Guide.Title, ::Theme, ::Gadfly.Aesthetics, ::Bool) at /Users/username/.julia/dev/Gadfly/src/guide.jl:141
 [5] #render_prepared#95(::Bool, ::Bool, ::Function, ::Plot, ::Gadfly.Coord.Cartesian, ::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 /Users/username/.julia/dev/Gadfly/src/Gadfly.jl:821
 [6] render_prepared(::Plot, ::Gadfly.Coord.Cartesian, ::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 /Users/username/.julia/dev/Gadfly/src/Gadfly.jl:801
 [7] render(::Plot) at /Users/username/.julia/dev/Gadfly/src/Gadfly.jl:747
 [8] draw(::Compose.Image{Compose.PDFBackend}, ::Plot) at /Users/username/.julia/dev/Gadfly/src/Gadfly.jl:852
 [9] top-level scope at none:0
 [10] include at ./boot.jl:317 [inlined]
 [11] include_relative(::Module, ::String) at ./loading.jl:1041
 [12] include(::Module, ::String) at ./sysimg.jl:29
 [13] exec_options(::Base.JLOptions) at ./client.jl:229
 [14] _start() at ./client.jl:421

@dehann
Copy link

dehann commented Oct 28, 2018

+1
Thanks for working on this!

Ubuntu 16.04, Julia 1.0.1, using Juno.

I'm stacking layers of Geom.contour, Geom.line, Geom.point, Geom.histogram2d as well as setting a specific Coord.Cartesian -- this seems to be enough to produce the 'UndefVarError: pangolayout not defined' issue. In my case I don't think it is related to drawing a figure to file.

@bjarthur
Copy link
Member

it's related to text. i'd bet if you turn off all labels, keys, and titles the error would go away.

i'm still working on pango support. quite difficult actually with the new BinaryBuilder system. might still be awhile.

@dehann
Copy link

dehann commented Oct 29, 2018

Great thanks. I actually did the same as @d9w and just added a single line to pango.jl in Compose.jl, and that seems to fix the issue:
https://github.com/d9w/Compose.jl/commit/c2acf841a9faddd8785697c915f106a8b52ebd7d
dehann/Compose.jl@7793350

EDIT: this workaround is not a long term fix rather just temporarily avoids the issue and produces poorly colored plots.

@montyvesselinov
Copy link

@d9w / @dehann : can you make a pull request; this "pangolayout not defined" is a major problem. Thank you very much!

dehann added a commit to JuliaRobotics/RoMEPlotting.jl that referenced this issue Nov 4, 2018
@dehann
Copy link

dehann commented Nov 5, 2018

Hi @montyvesselinov , I have mostly been using Gadfly but not contributed back to the repo much yet. The workaround above is probably not something we want to cement into the repo, however, I agree this issue is bit of a show stopper for Julia 0.7 upgrades. I'd defer to @bjarthur or @d9w on whether to include d9w/Compose.jl@c2acf84 / dehann/Compose.jl@7793350 as a temporary fix.

As example with the workaround, my figures are looking something like this (black background not intended):
x271

I appreciate though that the binary building issue bjarther offered to work on is difficult to deal with due to upstream changes.

One alternative might be that PangoLayout be exported from Compose so that we can all locally do the workaround as I attempted here. This did not work since PangoLayout is not discoverable downstream.

@montyvesselinov
Copy link

@dehann Thank you very much for your note. I highly appreciate your efforts. I am a big fan gadfly. The reason I am pushing for this is to be able to release our codes that depend on gadfly / compose. They work for me because I use the fixes above I cannot releases because the tests fail at the moment.

@bjarthur
Copy link
Member

bjarthur commented Nov 5, 2018

it's going to be awhile before the pango issue is resolved. i'd be fine merging this workaround into master for the time being.

@d9w
Copy link

d9w commented Nov 6, 2018

Thanks for making this a PR @dehann. I hesitated to do that originally in hopes of a better option. Best of luck @bjarthur for your work on pango, and thanks for working on a more permanent solution.

@bjarthur
Copy link
Member

bjarthur commented Nov 6, 2018

do you guys need GiovineItalia/Compose.jl#326 too?

@montyvesselinov
Copy link

montyvesselinov commented Nov 6, 2018 via email

@CiaranOMara
Copy link
Contributor Author

Both GiovineItalia/Compose.jl#325 and GiovineItalia/Compose.jl#326 appear to get Gadfly working for me.

@dehann
Copy link

dehann commented Nov 6, 2018

I understand 326 as making pangolayout functions discoverable downstream, which would be great.

Thanks again for working on the long term fix!

@bjarthur
Copy link
Member

bjarthur commented Dec 9, 2018

re. pango support in Gadfly... what features of pango do you guys need that is not recreated in Compose/src/fontfallback.jl? in other words, if you just using Gadfly, Cairo but omit using Fontconfig, what text are you unable to render properly? i ask, because ultimately i'd like to work towards reducing the number of uses cases for which pango is actually needed, by expanding Compose/src/fontfallback.jl functionality. thanks.

@CiaranOMara
Copy link
Contributor Author

@bjarthur, I just using Gadfly, Cairo but omit using Fontconfig. I'm not aware of which features I use specifically. I'm not doing anything special and only use the essential text features for plots. For example, title, ticks, axes labels, and legend. I don't know if this adequately answers your question.

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

Successfully merging a pull request may close this issue.

5 participants