Problems running Interact with julia 0.5


#1

Hello

I had some scripts using Interact which were running fine under julia 0.4.5 but when I tried to run them with julia 0.5 I get the following error:

MethodError: objects of type Array{Float64,1} are not callable Use square brackets [] for indexing an Array

Can anybody help?

Cheers

Ramon


#2

That sounds like an error of trying to copy paste MATLAB code A(4) into Julia, when it should be A[4].


#3

If it is Interact.jl you’re using, I also had some problems with it previously. I think it may need some maintenance to move it up to v"0.5", and certainly some to move it up to v"0.6.0-dev", to accommodate the syntax changes since v"0.4". If you feel comfortable with it, I’m sure a PR would be appreciated.

Here’s the build status, note it’s not even configured for v"0.5": https://travis-ci.org/JuliaGizmos/Interact.jl


#4

Thanks for your reply, Chris.

No, the script was written as a IJulia notebook which was just read and run by the new version.

Thanks anyway


#5

Thanks Felix

So, It looks like I will have to wait till the maintenance is carried out, too bad since I was using it for some classes and now I have to move back to 0.4 to run it.

Cheers

Ramón

By the way, sorry but what does PR mean?


#6

“PR” stands for “pull request”. If your issue is because of a problem in a package, and you find a fix for it, you can open a pull request on GitHub to have that fix included with the package.

For package problems, it’s often best to open an issue at the package repository. It also helps if you can include the code that’s causing the problem.


#7

I’m using Interact.jl regularly with julia 0.5 on both mac and linux, so it definitely should work. Can you provide more detail about the problem? Is there more to the error message than what you included in your first post? What code are you executing when the error happens?


#8

Is it using some pre-existing Jupyter installation?
I suggest you try the following:

ENV["JUPYTER"]="" 
Pkg.build("IJulia")`

You could also try deleting the .julia directory in your home directory and reinstalling the packages.


#9

I’ve opened a PR to add julia 0.5 builds to Interact, which should help us determine if there really is an issue: https://github.com/JuliaGizmos/Interact.jl/pull/157


#10

Thanks for your help this is the simple code that used to work under 0.4.5 and now it does not:

x = linspace(1,500)
@manipulate for α=0.001:0.001:0.02, β= 0:0.1:5
Gadfly.plot(layer(x=x,y=α*x+β, Geom.line),
layer(x=series[:,1]/1000, y=series[:,2], Geom.point),
Guide.xlabel(“Longitude”), Guide.ylabel(“Disp”), Guide.title(“Disp Vs Longitude”))
end

where
series[:,4] is just a four column array

this is the error now:

MethodError: call has no method matching call(::Array{Float64,1}, ::Base.KeyIterator{Dict{ASCIIString,Int64}})
Closest candidates are:
BoundsError()
BoundsError(::Any…)
DivideError()

in notify at /Users/ramon/.julia/v0.4/Interact/src/IJulia/setup.jl:77
in init_comm at /Users/ramon/.julia/v0.4/Interact/src/IJulia/setup.jl:82
in metadata at /Users/ramon/.julia/v0.4/Interact/src/IJulia/setup.jl:91
in execute_request at /Users/ramon/.julia/v0.4/IJulia/src/execute_request.jl:187
in eventloop at /Users/ramon/.julia/v0.4/IJulia/src/eventloop.jl:8
in anonymous at task.jl:447


#11

I already tried changing the environment variable for JUPYTER and did a Pkg.build(“IJulia”) since that didn’t work I deleted everything in .julia and installed from fresh using the 0.4.7 version just to try it out.
I got the same error.


#12

this is a sample of my data file series2

70000.0 2.2 4.1 3.0e10
80000.0 3.1 7.9 3.0e10
37000.0 2.5 6.2 3.0e10
61000.0 1.8 5.8 3.1e10
35000.0 1.1 3.5 3.3e10
60000.0 1.6 3.3 2.5e10
28000.0 1.66 1.9 3.2e10
10500.0 0.6 1.5 3.3e10
155000.0 2.1 3.5 3.2e10
4000.0 1.3 2.1 3.0e10
62000.0 1.1 5.2 3.0e10
47000.0 0.8 3.1 3.0e10
25000.0 2.5 5.4 3.0e10


#13

sorry, called series not series2 in the code


#14

I’ve tried running your code on my machine (OSX with Julia 0.5) and it worked just fine. I also tried it on JuliaBox with Julia 0.4.7 and Julia 0.5, and it worked fine in both cases.

To be clear, this is the exact code that I ran:

using Interact
using Gadfly

x = linspace(1,500)
series = [
70000.0 2.2 4.1 3.0e10
80000.0 3.1 7.9 3.0e10
37000.0 2.5 6.2 3.0e10
61000.0 1.8 5.8 3.1e10
35000.0 1.1 3.5 3.3e10
60000.0 1.6 3.3 2.5e10
28000.0 1.66 1.9 3.2e10
10500.0 0.6 1.5 3.3e10
155000.0 2.1 3.5 3.2e10
4000.0 1.3 2.1 3.0e10
62000.0 1.1 5.2 3.0e10
47000.0 0.8 3.1 3.0e10
25000.0 2.5 5.4 3.0e10
]
@manipulate for α=0.001:0.001:0.02, β= 0:0.1:5 
    Gadfly.plot(layer(x=x,y=α*x+β, Geom.line),
    layer(x=series[:,1]/1000, y=series[:,2], Geom.point),
    Guide.xlabel("Longitude"), Guide.ylabel("Disp"), Guide.title("Disp Vs Longitude"))
end

Are you certain that’s exactly the code that you were running too?


#15

Sorry to all.
The problem was strange, But after your reply it was solved once I closed and re-opened the notebook .
Something must have been hanging around which caused the conflict.
I now works with both versions of julia.

Thank you for your time, although I still do not know what exactly went wrong.


#16

No worries. I’m glad it’s working now


#17

Altough I still wonder since the first time Interact crashed was while copying the notebook to a fresh installation of julia on a laptop…
Anyway, thanks again