UndefVarError: imshow not defined


I’m having problems with a simple demo using JuliaImages. Here is what I get with Julia 0.5.2 and Jupyter:


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


 - Images                        0.5.14
 - TestImages                    0.2.0
 - ImageView                     0.2.0
UndefVarError: imshow not defined


The latest release of ImageView is 0.5.0, so try Pkg.update()ing your packages?


I had. I’m getting:

INFO: Updating METADATA...
INFO: Updating Plots dev...
INFO: Computing changes...
INFO: No packages to install, update or remove

and still:

 - Images                        0.5.14
 - TestImages                    0.2.0
 - ImageView                     0.2.0


Hm, maybe some package that depends on ImageView set an upper bound? Try Pkg.dependents("ImageView") and check the REQUIRES of the listed packages for upper bounds on ImageView and Images (since you have an old version of that too).


Do you mean requires file in packages directory, like this one for ImageRegistration dependent of ImageView:

julia 0.4


Yes, exactly. There might be an entry

ImageView 0.1 0.2

somewhere, which might indicate a lower bound of 0.1 and an upper bound of 0.2.


It should display automatically.

(Julia v0.6.)


Yes, ActiveAppearanceModels has this:

Docile 0.4
StatsBase 0.6
Images 0.4
ImageView 0.1
FixedPointNumbers 0.0.7
MultivariateStats 0.2
MAT 0.2
PiecewiseAffineTransforms 0.1
FaceDatasets 0.1


Automatic display works fine. I was going through a tutorial, which used imshow.

I was trying to find a method to display both 2D and 3D images. Automatic display doesn’t handle 3D images, but ImageView.view seems to display both just fine.


Can you post the results of Pkg.status() either here or to a gist? There’s some dependency which is preventing you from getting anything resembling recent releases of the JuliaImages suite. For example, the documentation will be all wrong for you.


Here is the result of Pkg.status():

I was trying a few visualization and plotting packages, so there may be some unusual dependencies there.


You’re on an old dev branch of Plots.jl. Probably not causing your issue, but you should probably Pkg.free().

What @pfitzseb is looking for is version bounds. @pauljurczak when there’s only one number that’s a lower bound: that should be okay. The issue is if there was

ImageView 0.1 0.2

That would prevent it from upgrading beyond 0.2. But since other packages like Optim are on exceedingly old releases as well, something tells me there’s a deeper problem here.


As Chris says, Pkg.free("Plots") is definitely the first thing to try. Notice that dev branch you’re on, most likely that is causing the problem.

If that doesn’t help, you could also try Pkg.pin("ColorTypes", v"0.5.1") (the current release) and then see what conflicts Pkg.update reports. That might give you some hint about what’s keeping you back from recent releases.

If you don’t have any unpushed commits, one drastic option is to make a copy of your ~/.julia/v0.5/REQUIRE file, then nuke your ~/.julia/v0.5 directory, then do Pkg.init(), copy your backup of your REQUIRE file into your shiny new ~/.julia/v0.5, and then do Pkg.update().

But like I said, only do this if you are certain that you don’t have any local changes to any packages. And it might not work if the problem is that something about your combination of packages causing problems.