Javis.jl icon indicating copy to clipboard operation
Javis.jl copied to clipboard

[BUG] ImageIO not automatically flagged as dependency for Javis.jl

Open flyaflya opened this issue 4 years ago • 10 comments

New Julia and Javis user here. Found my way here after exploring Luxor.jl. Thx for this package as animation is such an effective tool for conveying ideas.

Just wanted to report a very small error I received following Tutorial 1 instructions. When I ran render(...), I get

Fatal error:
ERROR: LoadError: ArgumentError: Package ImageIO not found in current path:
- Run `import Pkg; Pkg.add("ImageIO")` to install the ImageIO package.

The fix for me was easy, just add the ImageIO package. But if there a simple fix in the Javis code that flags the ImageIO package as a dependency, then future users may be saved this extra step and small hiccup when using Javis for the first time.

flyaflya avatar Mar 11 '21 19:03 flyaflya

Hi Adam,

thanks for joining the community. We actually have ImageIO as a dependency but we might need to do something else there. I'll try to test this on my end. Will let you know when I found out how to solve it.

Wikunia avatar Mar 11 '21 19:03 Wikunia

Unfortunately I'm not able to reproduce this issue. I tried it in a new environment, in the latest Julia version where I don't have ImageIO installed. Do you mind giving me some more information? What is the output of:

] status Javis

What is the output of

versioninfo()

Thanks in advance!

Wikunia avatar Mar 11 '21 20:03 Wikunia

Wow. That is fast service. My Julia install is very new and I do not have many packages installed.

Here is ] status Javis:

Status `C:\Users\ajf\.julia\environments\v1.5\Project.toml`
  [78b212ba] Javis v0.4.0

and here is versioninfo()

versioninfo()
Julia Version 1.5.3
Commit 788b2c77c1 (2020-11-09 13:37 UTC)

If it makes a difference, the only deviation I had from the tutorial was I added a using Luxor command after using Javis.

flyaflya avatar Mar 11 '21 20:03 flyaflya

I still have my terminal open and can go back through my history. When I installed Javis, it looks like ImageIO gets installed. Here is the relevant section of my REPL output:

Updating `C:\Users\ajf\.julia\environments\v1.5\Project.toml`
  [78b212ba] + Javis v0.4.0
Updating `C:\Users\ajf\.julia\environments\v1.5\Manifest.toml`
  [7b86fcea] + ATK_jll v2.34.1+5
  [27a7e980] + Animations v0.4.1
  [4fba245c] + ArrayInterface v3.1.5
  [13072b0f] + AxisAlgorithms v1.0.0
  [39de3d68] + AxisArrays v0.4.3
  [fa961155] + CEnum v0.4.1
  [aafaddc9] + CatIndices v0.2.2
  [ed09eef8] + ComputationalResources v0.3.2
  [150eb455] + CoordinateTransformations v0.6.1
  [dc8bdbbb] + CustomUnitRanges v1.0.1
  [ee1fde0b] + Dbus_jll v1.12.16+3
  [b4f34e82] + Distances v0.10.2
  [da5c29d0] + EllipsisNotation v1.1.0
  [c87230d0] + FFMPEG v0.4.0
  [b22a6f82] + FFMPEG_jll v4.3.1+4
  [4f61f5a4] + FFTViews v0.3.1
  [7a1cc6ca] + FFTW v1.3.2
  [f5851436] + FFTW_jll v3.3.9+7
  [77ec8976] + GTK3_jll v3.24.11+5
  [c27321d9] + Glob v1.3.0
  [75302f13] + Graphene_jll v1.10.0+2
  [4c0ca9eb] + Gtk v1.1.6
  [27996c0f] + GtkReactive v1.0.5
  [e91730f6] + Hungarian v0.6.0
  [bbac6d45] + IdentityRanges v0.3.1
  [615f187c] + IfElse v0.1.0
  [2803e5a7] + ImageAxes v0.6.8
  [f332f351] + ImageContrastAdjustment v0.3.6
  [51556ac3] + ImageDistances v0.2.12
  [6a3955dd] + ImageFiltering v0.6.20
  [82e4d734] + ImageIO v0.4.1
  [bc367c6b] + ImageMetadata v0.9.4
  [787d08f9] + ImageMorphology v0.2.9
  [2996bd0c] + ImageQualityIndexes v0.2.1
  [4e3cecfd] + ImageShow v0.2.3
  [02fcd773] + ImageTransformations v0.8.10
  [916415d5] + Images v0.23.3
  [9b13fd28] + IndirectArrays v0.5.1
  [1d5cc7b8] + IntelOpenMP_jll v2018.0.3+2
  [a98d9a8b] + Interpolations v0.13.1
  [8197267c] + IntervalSets v0.5.2
  [c8e1da08] + IterTools v1.3.0
  [78b212ba] + Javis v0.4.0
  [c1c5ebd0] + LAME_jll v3.100.0+3
  [b964fa9f] + LaTeXStrings v1.2.1
  [4af54fe1] + LazyArtifacts v1.3.0
  [dd192d2f] + LibVPX_jll v1.9.0+1
  [42c93a91] + Libepoxy_jll v1.5.4+1
  [7e76a0d4] + Libglvnd_jll v1.3.0+3
  [9c8b4983] + LightXML v0.9.0
  [856f044c] + MKL_jll v2021.1.1+1
  [f09324ee] + Netpbm v1.0.0
  [e7412a2a] + Ogg_jll v1.3.4+2
  [458c3c95] + OpenSSL_jll v1.1.1+6
  [91d4177d] + Opus_jll v1.3.1+3
  [f57f5aa1] + PNGFiles v0.3.6
  [d96e819e] + Parameters v0.12.2
  [92933f4c] + ProgressMeter v1.5.0
  [b3c3ace0] + RangeArrays v0.3.2
  [c84ed2f1] + Ratios v0.4.0
  [a223df75] + Reactive v0.8.3
  [ae029012] + Requires v1.1.3
  [6038ab10] + Rotations v1.0.2
  [d5f540fe] + RoundingIntegers v0.2.0
  [699a6c99] + SimpleTraits v0.9.3
  [aedffcd0] + Static v0.2.4
  [90137ffa] + StaticArrays v1.0.1
  [06e1c1a7] + TiledIteration v0.2.5
  [3a884ed6] + UnPack v1.0.2
  [d6d074c3] + VideoIO v0.8.4
  [a2964d1f] + Wayland_jll v1.17.0+4
  [2381bf8a] + Wayland_protocols_jll v1.18.0+4
  [efce3f68] + WoodburyMatrices v0.5.3
  [3c9796d7] + Xorg_libXcomposite_jll v0.4.5+4
  [935fb764] + Xorg_libXcursor_jll v1.2.0+4
  [0aeada51] + Xorg_libXdamage_jll v1.1.5+4
  [d091e8ba] + Xorg_libXfixes_jll v5.0.3+4
  [a51aa0fd] + Xorg_libXi_jll v1.7.10+4
  [d1454406] + Xorg_libXinerama_jll v1.1.4+4
  [ec84b674] + Xorg_libXrandr_jll v1.5.2+4
  [b6f176f1] + Xorg_libXtst_jll v1.2.3+4
  [cc61e674] + Xorg_libxkbfile_jll v1.1.0+4
  [35661453] + Xorg_xkbcomp_jll v1.4.2+4
  [33bec58e] + Xorg_xkeyboard_config_jll v2.27.0+4
  [b437f822] + adwaita_icon_theme_jll v3.33.92+5
  [de012916] + at_spi2_atk_jll v2.34.1+4
  [0fc3237b] + at_spi2_core_jll v2.34.0+4
  [059c91fe] + hicolor_icon_theme_jll v0.17.0+3
  [bf975903] + iso_codes_jll v4.3.0+4
  [0ac62f75] + libass_jll v0.14.0+4
  [f638f0a6] + libfdk_aac_jll v0.1.6+4
  [f27f6e37] + libvorbis_jll v1.3.6+6
  [1270edf5] + x264_jll v2020.7.14+2
  [dfaa095f] + x265_jll v3.0.0+3
  [d8fb68d0] + xkbcommon_jll v0.9.1+5

julia> using Javis
[ Info: Precompiling Javis [78b212ba-a7f9-42d4-b726-60726080707e]
WARNING: using Javis.fontsize in module Main conflicts with an existing identifier.
WARNING: using Javis.text in module Main conflicts with an existing identifier.
WARNING: using Javis.setline in module Main conflicts with an existing identifier.

julia> myvideo = Video(500,500) # 500 x 500 // width x height
Video(500, 500, Javis.AbstractObject[], Int64[], Dict{Symbol,Any}())

julia> using Luxor

julia> myvideo = Video(500,500) # 500 x 500 // width x height
Video(500, 500, Javis.AbstractObject[], Int64[], Dict{Symbol,Any}())

julia> function ground(args...) 
           background("white") # canvas background
           sethue("black") # pen color
       end
ground (generic function with 1 method)

object (generic function with 3 methods)

julia> myvideo = Video(500, 500)
Video(500, 500, Javis.AbstractObject[], Int64[], Dict{Symbol,Any}())

julia> Background(1:70, ground)
Object(Javis.Frames{UnitRange{Int64}}(1:70, 1:70), ground, Point(0.0, 0.0), Javis.AbstractAction[], Javis.ObjectSetting(1.0, 1.0, 1.0, 1.0, 10.0, true, Javis.Scale(1.0, 1.0), Javis.Scale(1.0, 1.0), 1.0), Dict{Symbol,Any}(:in_global_layer => true), Dict{Symbol,Any}(), Any[nothing])

julia> red_ball = Object(1:70, (args...) -> object(O, "red"), Point(100, 0))
Object(Javis.Frames{UnitRange{Int64}}(1:70, 1:70), var"#5#6"(), Point(100.0, 0.0), Javis.AbstractAction[], Javis.ObjectSetting(1.0, 
1.0, 1.0, 1.0, 10.0, true, Javis.Scale(1.0, 1.0), Javis.Scale(1.0, 1.0), 1.0), Dict{Symbol,Any}(), Dict{Symbol,Any}(), Any[nothing])
Errors encountered while saving nothing.
All errors:
===========================================
ArgumentError: Package ImageIO not found in current path:
- Run `import Pkg; Pkg.add("ImageIO")` to install the ImageIO package.

flyaflya avatar Mar 11 '21 20:03 flyaflya

Oh okay I would have expected other problems when you use using Luxor and using Javis at the same time. Javis does export the same functions as Luxor for you so it might mess some things up. Do you mind double checking with uninstalling ImageIO and maybe even Javis so starting from the previous state without the using Luxor to check whether the error still persists?

Wikunia avatar Mar 11 '21 20:03 Wikunia

I uninstalled ImageIO and Javis. Reinstalled only Javis. Left out the using Luxor and no problem - it works fine. I then added the using Luxor back in and the problem resurfaced. So this using Luxor is problematic.

So is Javis a superset of Luxor and they should not be loaded simultaneously? Or, is there some coding tweaks that should be done to have them play nicer together?

Thanks for warm welcome to the community and for all the help :-)

flyaflya avatar Mar 11 '21 20:03 flyaflya

That's great to hear. We might want to state that in the documentation as well then so I'll leave the issue open for now.

Yes Javis is a superpackage of Luxor if that makes sense. Basically for everything you can do with Javis you need Luxor and we found it a hassle to always include both of them. Therefore we reexport all the functions provided by Luxor ourselves and for some of them we actually override their method to enhance Javis itself. As an example for animating text fields we overwrote the text function to hijack it and get more information that is needed for animating it which would be available for us when one would call Luxor directly if that makes sense.

If you want to follow some Javis updates feel free to join us in the Julialang zulip as we have a Javis stream there.

Wikunia avatar Mar 11 '21 20:03 Wikunia

I am a little skeptical of the superpackage approach. Here is why.

My goal as a user of these packages is to make images and animations to convey ideas ... these images and animations would often be in the same notebook or script. Hence, to be a superpackage, everything I want to do in Luxor should be readily available by using Javis. So I tested this concept and got two errors on the first two things I tried:

Error1 using setline():

julia> using Javis

julia> Drawing()

julia> background(1, 1, 1, 0)
(1.0, 1.0, 1.0, 0.0)

julia> origin()

julia> setline(30)
ERROR: BoundsError: attempt to access 0-element Array{Object,1} at index [1]
Stacktrace:
 [1] getindex at .\array.jl:809 [inlined]
 [2] get_current_setting at C:\Users\ajf\.julia\packages\Javis\8IEwa\src\util.jl:49 [inlined]
 [3] setline(::Int64) at C:\Users\ajf\.julia\packages\Javis\8IEwa\src\luxor_overrides.jl:19
 [4] top-level scope at REPL[5]:1

And error 2 using @svg:

julia> @svg begin
           text("Can you see this?")
           end 400 400 "graphics/canUSeeThis.svg"
ERROR: BoundsError: attempt to access 0-element Array{Object,1} at index [1]
Stacktrace:
 [1] getindex at .\array.jl:809 [inlined]
 [2] text(::String, ::Point; valign::Symbol, halign::Symbol, angle::Float64) at C:\Users\ajf\.julia\packages\Javis\8IEwa\src\luxor_overrides.jl:243
 [3] text at C:\Users\ajf\.julia\packages\Javis\8IEwa\src\luxor_overrides.jl:243 [inlined] (repeats 2 times)
 [4] top-level scope at REPL[10]:2
 [5] top-level scope at C:\Users\ajf\.julia\packages\Luxor\LqBTI\src\drawings.jl:416

My thinking is that inter-operability of the two packages is more than a documentation isssue ... rather, it should be a feature request. Wouldn't you agree or am I missing something that might be obvious to more experienced Julia users?

Thx again for the package, I think it is really cool.

flyaflya avatar Mar 12 '21 15:03 flyaflya

I think it's a drawback yes but I think that the other way around would be even harder as we would still need to have the same functionality. I'm not sure whether there is a good way for both of these different workflows. I either have a one frame gif or write the the frames to a folder and then display that or load Luxor in a different file. The latter might be harder to work with in a notebook though. Do you know a workaround for it @TheCedarPrince ?

Wikunia avatar Mar 12 '21 16:03 Wikunia

Hey @Wikunia and @flyaflya - I was actually able to reproduce this error on a fresh installation of Julia (Julia 1.6.0 rc3) and when I tried to install Javis. For me, the error manifested when I was installing and running the Javis test suite for #303. I believe there may be a compatibility issue. Will continue digging into this right now.

TheCedarPrince avatar Mar 22 '21 01:03 TheCedarPrince