JuliaImages / ImageView.jl

Interactive display of images and movies
MIT License
134 stars 32 forks source link

LoadError: UndefVarError: imshow not defined #118

Closed krthr closed 7 years ago

krthr commented 7 years ago

I have this error

LoadError: UndefVarError: imshow not defined
while loading untitled, in expression starting on line 3
 in include_string(::String, ::String) at loading.jl:441
 in include_string(::Module, ::String, ::String) at eval.jl:34
 in (::Atom.##59#62{String,String})() at eval.jl:73
 in withpath(::Atom.##59#62{String,String}, ::String) at utils.jl:30
 in withpath(::Function, ::String) at eval.jl:38
 in macro expansion at eval.jl:71 [inlined]
 in (::Atom.##58#61{Dict{String,Any}})() at task.jl:60

when i run this:

using ImageView, TestImages
img = testimage("mandrill")
imshow(img)

But... I have installed "ImageView" and "TestImages" correctly :c

timholy commented 7 years ago

In such cases, the first thing to try is ImageView.imshow(img). My guess is you are using some other package that also exports imshow. Do you ever see a warning that's something like, WARNING: both ImageView and SomePackage export "imshow"; uses of it in module Main must be qualified?

krthr commented 7 years ago

It didn't work with ImageView.imshow(img) :(

timholy commented 7 years ago

What does Pkg.status("ImageView") say?

krthr commented 7 years ago

- ImageView 0.2.0

timholy commented 7 years ago

You're on a very old release, see https://github.com/timholy/ImageView.jl/releases.

There's something holding you back from getting the latest version. Can you post the entire contents of Pkg.status()?

krthr commented 7 years ago
 - ASTInterpreter                0.0.4
 - AbstractTrees                 0.0.4
 - ArgParse                      0.5.0
 - Atom                          0.5.10
 - AutoGrad                      0.0.6
 - AutoHashEquals                0.1.1
 - AxisAlgorithms                0.1.6
 - BinDeps                       0.5.0
 - Blink                         0.5.2
 - Blosc                         0.2.0
 - BufferedStreams               0.3.2
 - BusinessDays                  0.6.2
 - COFF                          0.0.2
 - CRC                           1.2.0
 - CSV                           0.1.4
 - Calculus                      0.2.2
 - CatIndices                    0.0.2
 - CategoricalArrays             0.1.3
 - Clustering                    0.8.0
 - CodeTools                     0.4.5
 - Codecs                        0.3.0
 - ColorTypes                    0.2.12
 - ColorVectorSpace              0.1.12
 - Colors                        0.6.9
 - Combinatorics                 0.4.0
 - Compat                        0.25.1
 - Compose                       0.5.1
 - Conda                         0.5.3
 - Contour                       0.3.0
 - CustomUnitRanges              0.0.4
 - DBAPI                         0.0.3
 - DSP                           0.2.0
 - DWARF                         0.1.0
 - DataArrays                    0.3.12
 - DataFrames                    0.9.1
 - DataStreams                   0.1.3
 - DataStructures                0.5.3
 - DecFP                         0.3.0
 - DecisionTree                  0.6.0
 - DiffBase                      0.1.0
 - Distances                     0.4.1
 - Distributions                 0.12.5
 - DualNumbers                   0.3.0
 - ELF                           0.1.0
 - EzXML                         0.4.3
 - FileIO                        0.3.1
 - FixedPointNumbers             0.2.1
 - Formatting                    0.2.1
 - ForwardDiff                   0.4.2
 - GLM                           0.7.0
 - GZip                          0.3.0
 - Gadfly                        0.6.1
 - Gallium                       0.0.4
 - Graphics                      0.2.0
 - HDF5                          0.8.1
 - HTTPClient                    0.2.1
 - Hexagons                      0.1.0
 - Hiccup                        0.1.1
 - HttpCommon                    0.2.7
 - HttpParser                    0.2.0
 - HttpServer                    0.2.0
 - HypothesisTests               0.5.1
 - IJulia                        1.5.0
 - ImageCore                     0.0.5
 - ImageMagick                   0.1.8
 - ImageView                     0.2.0
 - Images                        0.5.14
 - Interact                      0.4.5
 - Interpolations                0.6.1
 - Iterators                     0.3.1
 - JDBC                          0.1.0
 - JLD                           0.6.10
 - JSON                          0.12.0
 - JavaCall                      0.5.0
 - JuMP                          0.16.2
 - JuliaParser                   0.7.4
 - JuliaWebAPI                   0.2.1
 - Juno                          0.2.7
 - KernelDensity                 0.3.2
 - Knet                          0.8.2
 - LNR                           0.0.2
 - LaTeXStrings                  0.2.1
 - Lazy                          0.11.6
 - LegacyStrings                 0.2.1
 - LibCURL                       0.2.1
 - Libz                          0.2.4
 - LightGraphs                   0.7.6
 - LightXML                      0.5.0
 - LineSearches                  0.1.5
 - Loess                         0.2.0
 - Logging                       0.3.1
 - MLBase                        0.6.1
 - MNIST                         0.0.2
 - MXNet                         0.2.1
 - MachO                         0.0.4
 - MacroTools                    0.3.6
 - MappedArrays                  0.0.7
 - MathProgBase                  0.6.4
 - MbedTLS                       0.4.5
 - Measures                      0.1.0
 - Media                         0.2.7
 - Mocha                         0.2.0
 - Mustache                      0.1.4
 - Mux                           0.2.3
 - NaNMath                       0.2.4
 - NearestNeighbors              0.2.0
 - Nettle                        0.3.0
 - NullableArrays                0.1.0
 - ODBC                          0.5.2
 - ObjFileBase                   0.0.4
 - OffsetArrays                  0.3.0
 - Optim                         0.7.8
 - PDMats                        0.6.0
 - Parameters                    0.7.2
 - ParserCombinator              1.7.11
 - PolynomialFactors             0.0.5
 - Polynomials                   0.1.5
 - PositiveFactorizations        0.0.4
 - Primes                        0.1.3
 - ProtoBuf                      0.4.0
 - PyCall                        1.12.0
 - PyPlot                        2.3.2
 - QuadGK                        0.1.2
 - QuantEcon                     0.10.1
 - RCall                         0.6.4
 - Ratios                        0.0.4
 - Reactive                      0.5.0
 - Reexport                      0.0.3
 - Requests                      0.4.1
 - Requires                      0.3.0
 - ReverseDiffSparse             0.7.2
 - Rmath                         0.1.6
 - Roots                         0.3.1
 - Rotations                     0.3.5
 - SHA                           0.3.2
 - SIUnits                       0.1.0
 - ScikitLearnBase               0.3.0
 - ShowItLikeYouBuildIt          0.0.1
 - Showoff                       0.1.1
 - SortingAlgorithms             0.1.1
 - SpecialFunctions              0.1.1
 - StaticArrays                  0.3.1
 - StatsBase                     0.13.1
 - StatsFuns                     0.5.0
 - StructIO                      0.0.2
 - TerminalUI                    0.0.2
 - TestImages                    0.2.0
 - TexExtensions                 0.0.3
 - TextWrap                      0.2.0
 - TiledIteration                0.0.2
 - Tokenize                      0.1.8
 - URIParser                     0.1.8
 - VT100                         0.0.2
 - WeakRefStrings                0.2.0
 - WebSockets                    0.2.3
 - WoodburyMatrices              0.2.2
 - ZMQ                           0.4.2
 - Zlib                          0.1.12
8 additional packages:
 - AxisArrays                    0.1.4
 - Cairo                         0.3.0
 - IniFile                       0.3.1
 - IntervalSets                  0.1.1
 - RangeArrays                   0.2.0
 - Tk                            0.5.2
 - Winston                       0.13.1
 - ZipFile                       0.4.0
timholy commented 7 years ago

OK, so you don't have any pinned or dirty packages. However, the Image-related packages are held back to very old versions. @tkelman, is this a resolver issue or an upper bounds issue?

We really need some tool that says "here's why I'm not upgrading Pkg X." I keep trying to stay out of Pkg (there have to be some limits on the number of areas I dig into...), but if it's really a linear programming optimization then presumably one is optimizing some kind of w⋅v where v is the vector of version numbers and w is a weight vector, perhaps all-ones by default? In that case, by customizing w it seems like you gain the ability to diagnose package conflicts: if you supply a weight of all-zeros (or all-tiny) to everything but, e.g., Images, then the resulting proposed changes seem like they should give a great deal of insight into what's holding back Images.

tkelman commented 7 years ago

What platform, what Julia version? Probably something there is upper-bounding Images, not positive what.

Some way of influencing the resolver's objective function would be incredibly useful, I agree. Something like "recommended bounds" in addition to minimum requirements as a way of increasing the weight on certain versions, and a "no longer maintained" indicator as a way of decreasing the weight on old versions could be ways of doing that.

timholy commented 7 years ago

@wilsontov, perhaps the best expedient would be to say Pkg.pin("Images", v"0.11.0") and then tell us what, if anything, gets uninstalled.

tkelman commented 7 years ago

Or try running

for (pkg, ver) in Pkg.installed()
    reqfile = Pkg.dir("METADATA", pkg, "versions", string(ver), "requires")
    reqs = Pkg.Reqs.parse(isfile(reqfile) ? reqfile : Pkg.dir(pkg, "REQUIRE"))
    for (dep, bounds) in reqs
        if any(x -> x.upper != typemax(VersionNumber), bounds.intervals)
            info("$pkg v$ver has upper bounds on $dep")
        end
    end
end
krthr commented 7 years ago

@timholy

julia> Pkg.pin("Images", v"0.11.0")
INFO: Creating Images branch pinned.00000000.tmp
ERROR: MethodError: no method matching create_branch(::Base.LibGit2.GitRepo, ::String, ::Void)
Closest candidates are:
  create_branch(::Base.LibGit2.GitRepo, ::AbstractString, ::Base.LibGit2.GitCommit; force) at libgit2/reference.jl:119
 in (::Base.Pkg.Entry.##31#33{String,String})(::Base.LibGit2.GitRepo) at ./pkg/entry.jl:321
 in with(::Base.Pkg.Entry.##31#33{String,String}, ::Base.LibGit2.GitRepo) at ./libgit2/types.jl:701
 in pin(::String, ::String) at ./pkg/entry.jl:295
 in pin(::String, ::VersionNumber) at ./pkg/entry.jl:348
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#pin,Tuple{String,VersionNumber}})() at ./pkg/dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#pin,Tuple{String,VersionNumber}}, ::String) at ./file.jl:59
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at ./pkg/dir.jl:31
 in pin(::String, ::VersionNumber) at ./pkg/pkg.jl:198
krthr commented 7 years ago

@tkelman

INFO: ForwardDiff v0.4.2 has upper bounds on DiffBase
INFO: ColorVectorSpace v0.1.12 has upper bounds on FixedPointNumbers
INFO: ImageMagick v0.1.8 has upper bounds on Images
INFO: ImageMagick v0.1.8 has upper bounds on FixedPointNumbers
INFO: ReverseDiffSparse v0.7.2 has upper bounds on ForwardDiff
INFO: ASTInterpreter v0.0.4 has upper bounds on AbstractTrees
INFO: ColorTypes v0.2.12 has upper bounds on FixedPointNumbers
INFO: ImageCore v0.0.5 has upper bounds on FixedPointNumbers
INFO: Optim v0.7.8 has upper bounds on LineSearches
INFO: Optim v0.7.8 has upper bounds on ForwardDiff
INFO: Images v0.5.14 has upper bounds on FixedPointNumbers
INFO: ImageView v0.2.0 has upper bounds on Images
INFO: JuMP v0.16.2 has upper bounds on ForwardDiff
INFO: JuMP v0.16.2 has upper bounds on ReverseDiffSparse
INFO: JuMP v0.16.2 has upper bounds on MathProgBase
INFO: DataArrays v0.3.12 has upper bounds on julia
INFO: Colors v0.6.9 has upper bounds on FixedPointNumbers
INFO: Rotations v0.3.5 has upper bounds on StaticArrays
tkelman commented 7 years ago

When was the last time you ran Pkg,update() ? What is versioninfo() ? If you go into ~/.julia/v0.5/METADATA and run git status, what does it say?

krthr commented 7 years ago

I ran Pkg.update() today.

julia> Pkg.update()
INFO: Updating METADATA...
INFO: Updating ZeroRPC master...
INFO: Computing changes...
INFO: No packages to install, update or remove
julia> versioninfo()
Julia Version 0.5.2
Commit f4c6c9d (2017-05-06 16:34 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, sandybridge)

And i dont have /.julia/v0.5/METADATA, i have /.julia/v0.6/METADATA:

karther@karther:~/.julia/v0.6/METADATA$ git status
En la rama metadata-v2
Su rama está actualizada con «origin/metadata-v2».
nothing to commit, working directory clean
timholy commented 7 years ago

Interesting indeed. You're running Julia 0.5.2 but only have a v0.6 package directory? Did you do something to symlink one to the other? That won't work, because package versions also depend on the Julia version, so you need to have two separate package folders for two different versions of Julia.

tkelman commented 7 years ago

Why would ZeroRPC show up in Pkg.update but not Pkg.status? Something about your setup (anything in juliarc?) seems customized in a way that doesn't make a lot of sense without more explanation.

timholy commented 7 years ago

@wilsontov, any further help we can give or should I close this? It looks like you've customized your setup in some way that's breaking things, your best strategy is to wipe your .julia directory and start from scratch.

tkelman commented 7 years ago

If you post ~/.julia/v0.5/REQUIRE I'm happy to try reproducing this - if you don't have a file there, then we don't have enough info about what you've customized to debug this

timholy commented 7 years ago

This is a problem with the package management, and without more info we can't do any more anyway.