Error with package ApproxFun

How to solve this error of the ApproxFunc Package?

[ Info: Precompiling ApproxFun [28f2ccd6-bb30-5033-b560-165f7b14dc2f]
ERROR: LoadError: LoadError: TypeError: in BlockIndexRange, in R, expected R<:Tuple{Vararg{AbstractU
nitRange{Int32},N}}, got Type{Tuple{UnitRange{Int64}}}
Stacktrace:
 [1] top-level scope at none:0
 [2] include at .\sysimg.jl:29 [inlined]
 [3] include(::String) at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\BlockBanded
Matrices.jl:2
 [4] top-level scope at none:0
 [5] include at .\boot.jl:317 [inlined]
 [6] include_relative(::Module, ::String) at .\loading.jl:1044
 [7] include(::Module, ::String) at .\sysimg.jl:29
 [8] top-level scope at none:2
 [9] eval at .\boot.jl:319 [inlined]
 [10] eval(::Expr) at .\client.jl:393
 [11] top-level scope at .\none:3
in expression starting at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\linalg.jl:4

in expression starting at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\BlockBanded
Matrices.jl:54
ERROR: LoadError: Failed to precompile BlockBandedMatrices [ffab5731-97b5-5995-9138-79e8c1846df0] to
 C:\Users\hermesr\.julia\compiled\v1.0\BlockBandedMatrices\0zTvf.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:311 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1190
 [4] macro expansion at .\logging.jl:309 [inlined]
 [5] _require(::Base.PkgId) at .\loading.jl:947
 [6] require(::Base.PkgId) at .\loading.jl:858
 [7] macro expansion at .\logging.jl:309 [inlined]
 [8] require(::Module, ::Symbol) at .\loading.jl:840
 [9] include at .\boot.jl:317 [inlined]
 [10] include_relative(::Module, ::String) at .\loading.jl:1044
 [11] include(::Module, ::String) at .\sysimg.jl:29
 [12] top-level scope at none:2
 [13] eval at .\boot.jl:319 [inlined]
 [14] eval(::Expr) at .\client.jl:393
 [15] top-level scope at .\none:3
in expression starting at C:\Users\hermesr\.julia\packages\ApproxFun\DkMmw\src\ApproxFun.jl:4
ERROR: LoadError: Failed to precompile ApproxFun [28f2ccd6-bb30-5033-b560-165f7b14dc2f] to C:\Users\
hermesr\.julia\compiled\v1.0\ApproxFun\jGqLz.ji.
Stacktrace:
 [1] macro expansion at .\logging.jl:311 [inlined]
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1190
 [3] macro expansion at .\logging.jl:309 [inlined]
 [4] _require(::Base.PkgId) at .\loading.jl:947
 [5] require(::Base.PkgId) at .\loading.jl:858
 [6] macro expansion at .\logging.jl:309 [inlined]
 [7] require(::Module, ::Symbol) at .\loading.jl:840
in expression starting at C:\Users\hermesr\Documents\Julia software\Julia Scripts\Introduccion Appro
xFun 1.jl:1

I have no problem adding ApproxFun with julia 1.0.2.
Maybe you have a version issue? It looks like the error is related to BlockBandedMatrices.
Which version of ApproxFun and BlockBandedMatrices do you want to use?

It’s best to file this as an issue https://github.com/JuliaApproximation/ApproxFun.jl

1 Like

installed add https://github.com/JuliaApproximation/ApproxFun.jl

I keep getting problems:

[ Info: Precompiling ApproxFun [28f2ccd6-bb30-5033-b560-165f7b14dc2f]
ERROR: LoadError: LoadError: TypeError: in BlockIndexRange, in R, expected R<:Tuple{Vararg{AbstractU
nitRange{Int32},N}}, got Type{Tuple{UnitRange{Int64}}}
Stacktrace:
 [1] top-level scope at none:0
 [2] include at .\sysimg.jl:29 [inlined]
 [3] include(::String) at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\BlockBanded
Matrices.jl:2
 [4] top-level scope at none:0
 [5] include at .\boot.jl:317 [inlined]
 [6] include_relative(::Module, ::String) at .\loading.jl:1044
 [7] include(::Module, ::String) at .\sysimg.jl:29
 [8] top-level scope at none:2
 [9] eval at .\boot.jl:319 [inlined]
 [10] eval(::Expr) at .\client.jl:393
 [11] top-level scope at .\none:3
in expression starting at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\linalg.jl:4

in expression starting at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\BlockBanded
Matrices.jl:54
ERROR: LoadError: Failed to precompile BlockBandedMatrices [ffab5731-97b5-5995-9138-79e8c1846df0] to
 C:\Users\hermesr\.julia\compiled\v1.0\BlockBandedMatrices\0zTvf.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:311 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1190
 [4] macro expansion at .\logging.jl:309 [inlined]
 [5] _require(::Base.PkgId) at .\loading.jl:947
 [6] require(::Base.PkgId) at .\loading.jl:858
 [7] macro expansion at .\logging.jl:309 [inlined]
 [8] require(::Module, ::Symbol) at .\loading.jl:840
 [9] include at .\boot.jl:317 [inlined]
 [10] include_relative(::Module, ::String) at .\loading.jl:1044
 [11] include(::Module, ::String) at .\sysimg.jl:29
 [12] top-level scope at none:2
 [13] eval at .\boot.jl:319 [inlined]
 [14] eval(::Expr) at .\client.jl:393
 [15] top-level scope at .\none:3
in expression starting at C:\Users\hermesr\.julia\packages\ApproxFun\DkMmw\src\ApproxFun.jl:4
ERROR: LoadError: Failed to precompile ApproxFun [28f2ccd6-bb30-5033-b560-165f7b14dc2f] to C:\Users\
hermesr\.julia\compiled\v1.0\ApproxFun\jGqLz.ji.
Stacktrace:
 [1] macro expansion at .\logging.jl:311 [inlined]
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1190
 [3] macro expansion at .\logging.jl:309 [inlined]
 [4] _require(::Base.PkgId) at .\loading.jl:947
 [5] require(::Base.PkgId) at .\loading.jl:858
 [6] macro expansion at .\logging.jl:309 [inlined]
 [7] require(::Module, ::Symbol) at .\loading.jl:840
in expression starting at C:\Users\hermesr\Documents\Julia software\Julia Scripts\Introduccion Appro
xFun 1.jl:1

BlockBandedMatrices was installed as a dependency of some other package. I did not install it directly.
execute the following

rm BlockBandedMatrices
add BlockBandedMatrices

and the problem persists

Is there any way to see package dependency tree in julia 1.0.2?

What’s your Pkg.status()

After installation

add https://github.com/JuliaApproximation/ApproxFun.jl

perform the following steps:

(v1.0) pkg> rm ApproxFun
  Updating `C:\Users\hermesr\.julia\environments\v1.0\Project.toml`
  [28f2ccd6] - ApproxFun v0.10.2+ #master (https://github.com/JuliaApproximation
/ApproxFun.jl)
  Updating `C:\Users\hermesr\.julia\environments\v1.0\Manifest.toml`
 [no changes]

(v1.0) pkg> dev https://github.com/JuliaApproximation/ApproxFun.jl.git
   Cloning git-repo `https://github.com/JuliaApproximation/ApproxFun.jl.git`
  Updating git-repo `https://github.com/JuliaApproximation/ApproxFun.jl.git`
 Resolving package versions...
  Updating `C:\Users\hermesr\.julia\environments\v1.0\Project.toml`
  [28f2ccd6] + ApproxFun v0.10.2+ [`C:\Users\hermesr\.julia\dev\ApproxFun`]
  Updating `C:\Users\hermesr\.julia\environments\v1.0\Manifest.toml`
  [28f2ccd6] ~ ApproxFun v0.10.2+ #master (https://github.com/JuliaApproximation
/ApproxFun.jl) ? v0.10.2+ [`C:\Users\hermesr\.julia\dev\ApproxFun`]

(v1.0) pkg> st
    Status `C:\Users\hermesr\.julia\environments\v1.0\Project.toml`
  [28f2ccd6] ApproxFun v0.10.2+ [`C:\Users\hermesr\.julia\dev\ApproxFun`]
  [d9fa014c] ApproxFunExamples v0.1.0 #master (https://github.com/JuliaApproxima
tion/ApproxFunExamples.git)
  [c52e3926] Atom v0.7.10
  [717857b8] DSP v0.5.1
  [a93c6f00] DataFrames v0.14.1
  [225cb15b] DiffEqTutorials v0.0.0 #master (https://github.com/JuliaDiffEq/Diff
EqTutorials.jl.git)
  [0c46a032] DifferentialEquations v5.3.1
  [7073ff75] IJulia v1.14.1
  [e5e0dc1b] Juno v0.5.3
  [1902f260] Knet v1.1.1
  [ff71e718] MixedModels v1.1.1
  [5fb14364] OhMyREPL v0.4.0
  [1dea7af3] OrdinaryDiffEq v4.17.2
  [91a5bcdd] Plots v0.21.0
  [438e738f] PyCall v1.18.5
  [d330b81b] PyPlot v2.6.3
  [6f49c342] RCall v0.13.0
  [df47a6cb] RData v0.5.0
  [ce6b1742] RDatasets v0.6.1
  [276daf66] SpecialFunctions v0.7.2
  [44dac47c] VMLS v0.2.0 #master (https://github.com/VMLS-book/VMLS.jl)
  [bd07be1c] Winston v0.14.1
  [37e2e46d] LinearAlgebra
  [9a3f8284] Random
  [2f01184e] SparseArrays

(v1.0) pkg>

And I still have problems:

[ Info: Precompiling ApproxFun [28f2ccd6-bb30-5033-b560-165f7b14dc2f]
ERROR: LoadError: LoadError: TypeError: in BlockIndexRange, in R, expected R<:Tuple{Vararg{AbstractU
nitRange{Int32},N}}, got Type{Tuple{UnitRange{Int64}}}
Stacktrace:
 [1] top-level scope at none:0
 [2] include at .\sysimg.jl:29 [inlined]
 [3] include(::String) at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\BlockBanded
Matrices.jl:2
 [4] top-level scope at none:0
 [5] include at .\boot.jl:317 [inlined]
 [6] include_relative(::Module, ::String) at .\loading.jl:1044
 [7] include(::Module, ::String) at .\sysimg.jl:29
 [8] top-level scope at none:2
 [9] eval at .\boot.jl:319 [inlined]
 [10] eval(::Expr) at .\client.jl:393
 [11] top-level scope at .\none:3
in expression starting at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\linalg.jl:4

in expression starting at C:\Users\hermesr\.julia\packages\BlockBandedMatrices\fQqi6\src\BlockBanded
Matrices.jl:54
ERROR: LoadError: Failed to precompile BlockBandedMatrices [ffab5731-97b5-5995-9138-79e8c1846df0] to
 C:\Users\hermesr\.julia\compiled\v1.0\BlockBandedMatrices\0zTvf.ji.
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] macro expansion at .\logging.jl:311 [inlined]
 [3] compilecache(::Base.PkgId, ::String) at .\loading.jl:1190
 [4] macro expansion at .\logging.jl:309 [inlined]
 [5] _require(::Base.PkgId) at .\loading.jl:947
 [6] require(::Base.PkgId) at .\loading.jl:858
 [7] macro expansion at .\logging.jl:309 [inlined]
 [8] require(::Module, ::Symbol) at .\loading.jl:840
 [9] include at .\boot.jl:317 [inlined]
 [10] include_relative(::Module, ::String) at .\loading.jl:1044
 [11] include(::Module, ::String) at .\sysimg.jl:29
 [12] top-level scope at none:2
 [13] eval at .\boot.jl:319 [inlined]
 [14] eval(::Expr) at .\client.jl:393
 [15] top-level scope at .\none:3
in expression starting at C:\Users\hermesr\.julia\dev\ApproxFun\src\ApproxFun.jl:4
ERROR: LoadError: Failed to precompile ApproxFun [28f2ccd6-bb30-5033-b560-165f7b14dc2f] to C:\Users\
hermesr\.julia\compiled\v1.0\ApproxFun\jGqLz.ji.
Stacktrace:
 [1] macro expansion at .\logging.jl:311 [inlined]
 [2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1190
 [3] macro expansion at .\logging.jl:309 [inlined]
 [4] _require(::Base.PkgId) at .\loading.jl:947
 [5] require(::Base.PkgId) at .\loading.jl:858
 [6] macro expansion at .\logging.jl:309 [inlined]
 [7] require(::Module, ::Symbol) at .\loading.jl:840
in expression starting at C:\Users\hermesr\Documents\Julia software\Julia Scripts\Introduccion Appro
xFun 1.jl:1
julia>

Alert in Atom

Error evaluating Introduccion ApproxFun 1.jl
LoadError: Failed to precompile ApproxFun [28f2ccd6-bb30-5033-b560-165f7b14dc2f] to C:\Users\hermesr\.julia\compiled\v1.0\ApproxFun\jGqLz.ji.
in expression starting at C:\Users\hermesr\Documents\Julia software\Julia Scripts\Introduccion ApproxFun 1.jl:1
error(::String) at error.jl:33
macro expansion at logging.jl:311 [inlined]
compilecache(::Base.PkgId, ::String) at loading.jl:1190
macro expansion at logging.jl:309 [inlined]
_require(::Base.PkgId) at loading.jl:947
require(::Base.PkgId) at loading.jl:858
macro expansion at logging.jl:309 [inlined]
require(::Module, ::Symbol) at loading.jl:840

Are you on a 32-bit machine? If yes, I would recommend to do

pgk> add BlockBandedMatrices#master

because of this. Then you can retry compiling ApproxFun.

Solved the problem:

@Gracias

It’s recommended to stick to tagged versions of the packages as the master branch is often experimentalz

Please tell me how to do it

Sure. But if he is on a 32-bit machine and this fix is not yet on a newly tagged version?

The issue is that he’s running ApproxFun.jl on master. The tagged version is tested and passes on 32 bit machines.

Yes I work in 32-bit Operating System!!

Ah, you’re right @dlfivefifty, dev https://github.com/JuliaApproximation/ApproxFun.jl.git pulls the master branch.

edit: I think ApproxFun#master is currently identical to the last tagged version.
I think the problem really is that BlockBandedMatrices#0.3.0 doesn’t work on 32-bit machines.

I’ll tag new versions now

Until recently everything worked well, now I have the following error and I do not know what to do, EVERYTHING WAS GOOD!

using LinearAlgebra, SpecialFunctions, Plots, ApproxFun
x = Fun(identity,0..10)
f = sin(x^2)
g = cos(x)
h = f + g^2
r = roots(h)
rp = roots(h')

using Plots
plot(h)
scatter!(r,h.(r))
scatter!(rp,h.(rp))


Error evaluating Introduccion ApproxFun 1.jl
LoadError: invalid redefinition of constant f
in expression starting at C:\Users\hermesr\Documents\Julia software\Julia Scripts\Introduccion ApproxFun 1.jl:3
top-level scope at none:0

This same error is repeated in other examples.

Error evaluating Introduccion ApproxFun 4.jl
LoadError: invalid redefinition of constant f
in expression starting at C:\Users\hermesr\Documents\Julia software\Julia Scripts\UsoApproxFun\Introduccion ApproxFun 4.jl:2
top-level scope at none:0

This sounds like you have used some constant called f so redefining it to f = sin(x^2) fails. I suggest restarting Julia (if you have had a variable f) or renaming your function to something else.

Perfect!!! Work
Is there an instruction to clean the WorkSpace?

None that I’m aware of, except restarting Julia. But maybe someone else knows a way.

A good way around this would be to give the variables and functions more descriptive names so it is harder that these “accidental collision” happen. For me this also had the benefit that I am much more likely to understand my own code after not looking at it for two weeks.