Error requiring `StaticArrays` from `ArrayInterface`

I am starting with Makie. I installed Makie and CairoMakie; the editor is VSCode
I am trying to run the following example, taken from the juliaplots.org website:

using Makie

x = rand(10)
y = rand(10)
colors = rand(10)
scene = scatter(x, y, color = colors)

Whatever I try, I get the following warning + error:

Warning: Error requiring `StaticArrays` from `ArrayInterface`
│   exception =
│    too many parameters for type

etc.etc. (long list)

This is my packages status:

    Status `~/Tresors/Julia/Project.toml`
  [4fba245c] ArrayInterface v3.1.30
  [a134a8b2] BlackBoxOptim v0.5.0
  [336ed68f] CSV v0.8.5
  [13f3f980] CairoMakie v0.2.4
  [a93c6f00] DataFrames v1.2.2
  [7806a523] DecisionTree v0.10.10
  [31c24e10] Distributions v0.23.8
  [60bf3e95] GLPK v0.14.12
  [a2cc645c] GraphPlot v0.4.4
  [86223c79] Graphs v0.10.3
  [3955a311] GridLayoutBase v0.5.7
  [4076af6c] JuMP v0.21.9
  [aa1ae85d] JuliaInterpreter v0.8.21
  [093fc24a] LightGraphs v1.3.5
  [ee78f7c6] Makie v0.10.0
  [d330b81b] PyPlot v2.9.0
  [3646fa90] ScikitLearn v0.6.4
  [60ddc479] StatPlots v0.9.2
  [90137ffa] StaticArrays v0.12.5
  [fdbf4ff8] XLSX v0.7.6

What am I missing or doing wrong?

I hope someone may be able to help out

Hi @Empirilogic ,

it looks like some of your packages are quite outdated. What julia version are you on?

Please not that the documentation for Makie is here: Home
Also, it is recommended to use Makie backends (GLMakie, CairoMakie, WGLMakie directly).

You could try to remove Makie and add CairoMakie. (The latest release of CairoMakie is v0.6.5)

] rm Makie
] add CairoMakie
using CairoMakie
scatter(rand(10), rand(10), color=rand(10))

Hi Jonas, thanks for replying.

I am using Julia 1.6.2.
I tried your suggestion, without success. using Makie, CairoMakie or using both.
Removed until I had only Makie or CairoMakie. Not working.
I forgot to mention I am running VSCode on a Mac.

I agree that the versions are quite old. Odd.

Hi @Empirilogic,

it could very well be that some of the other packages are holding up the version update.
Just to verify, did you restart julia after installing the new CairoMakie ?

Try installing CairoMakie into a new environment, e.g. :

using Pkg
Pkg.activate(; temp=true)
Pkg.add("CairoMakie")
using CairoMakie
scatter(rand(10), rand(10), color=rand(10))

Can you try to ]add Makie@v0.15.2 (the most recent version)? That should tell us what is holding it back, should that be the case.

That worked in the temp environment. Install went well and graph plotted

Good tip. I got this:

(Julia) pkg> add Makie@v0.15.2
Updating registry at ~/.julia/registries/General
Resolving package versions…
ERROR: Unsatisfiable requirements detected for package PlotUtils [995b91a9]:
PlotUtils [995b91a9] log:
├─possible versions are: 0.5.0-1.0.13 or uninstalled
├─restricted by compatibility requirements with Makie [ee78f7c6] to versions: 1.0.0-1.0.13
│ └─Makie [ee78f7c6] log:
│ ├─possible versions are: 0.9.0-0.15.2 or uninstalled
│ └─restricted to versions 0.15.2 by an explicit requirement, leaving only versions 0.15.2
└─restricted by compatibility requirements with Plots [91a5bcdd] to versions: 0.5.0-0.6.5 — no versions left
└─Plots [91a5bcdd] log:
├─possible versions are: 0.12.1-1.21.2 or uninstalled
├─restricted by compatibility requirements with StatPlots [60ddc479] to versions: 0.14.0-0.29.9
│ └─StatPlots [60ddc479] log:
│ ├─possible versions are: 0.8.0-0.9.2 or uninstalled
│ └─restricted to versions * by an explicit requirement, leaving only versions 0.8.0-0.9.2
└─restricted by compatibility requirements with FixedPointNumbers [53c48c17] to versions: 0.25.0-1.21.2 or uninstalled, leaving only versions: 0.25.0-0.29.9
└─FixedPointNumbers [53c48c17] log:
├─possible versions are: 0.5.0-0.8.4 or uninstalled
└─restricted by compatibility requirements with Makie [ee78f7c6] to versions: 0.6.0-0.8.4
└─Makie [ee78f7c6] log: see above

Plots is installed, but not in the status list:

julia> using Plots

julia> using PlotUtils
ERROR: ArgumentError: Package PlotUtils not found in current path:
- Run `import Pkg; Pkg.add("PlotUtils")` to install the PlotUtils package.

PlotUtils is not installed

Can I clean the apparent mess by reinstalling Julia? Does that help for the toml files?
Earlier, I installed Jupyter for working with Julia (required MiniConda). Maybe the PATH has something to do with it

You have a lot of different plotting packages in the same environment that share a dependency (PlotUtils). Since only one version of a dependency can be loaded at any given time, a common state is found by downgrading versions until they’re compatible. This may not give you the most recent version of packages and the fact that a lot of packages don’t want to commit to a 1.x doesn’t help here.

If you’re just trying out plotting packages, I’d recommend familiarizing yourself with Pkg environments to seperate experimentation and different projects.

There’s no need to reinstall julia. It’s just a package environment that has old versions due to dependency management.

No, the PATH is not touched by julia. Julia usually handles those packages (and especially python dependencies) in a seperate environment, to make sure they don’t mess with the system version (unless you explicitly ask for the system version to be used).

Thanks. I was indeed checking capabilities and ease of use of plotting packages. I am coming from R and I am quite impressed with Julia.
I will use the environments in the future for testing purposes.

I will remove all plotting packages besides Plots and CairoMakie. See if I can install Makie 0.15.2

Just to be sure don’t just use environments for testing purposes, but use them for everything - when you start some new project give it it’s own folder, ] activate an environment in that folder, and add the packages you need. Then when you go back to that project in a few weeks/months/years time, the Project.toml and Manifest.toml files will still be there to ensure your code still runs, and isn’t broken because of some package updates that happened in the meantime. Having this built into the language and so easily accessible is one of the big benefits of Julia imho.

3 Likes

Yes exactly. It will also prevent cross-contamination of dependencies from happening between different projects of yours.

Think like this: Project A requires some package B at version 0.3, which requires Package C at version <=0.2. Project A1 requires package B at version 0.4, which requires Package C at version >1. If you have two environments, one for Project A and one for A1, you can work in them seperately and they won’t interfere. If, however, you use the same environment for both of them, things won’t work for one of the two projects because you can’t have both C@v1 and C@v0.2 active at the same time.

1 Like

Thank you @Sukera and @nilshg
That prevent so many problems by the rookie mistakes I will make. I will read up about using environments in Julia.

I removed the majority of plotting packages, Makie 0.15.2 and CairoMakie 0.6.5 install successfully and plots are being made!

2 Likes

The first line number would help.
ArrayInterface already has a check to avoid this error:

if StaticArrays.SizedArray{Tuple{8,8},Float64,2,2} isa UnionAll
  @inline strides(B::StaticArrays.SizedArray{S,T,M,N,A}) where {S,T,M,N,A<:SubArray} = strides(B.data)
  parent_type(::Type{<:StaticArrays.SizedArray{S,T,M,N,A}}) where {S,T,M,N,A} = A
else
  parent_type(::Type{<:StaticArrays.SizedArray{S,T,M,N}}) where {S,T,M,N} =
    Array{T,N}
end

and used to work with StaticArrays 0.12.5.
So I’d like to have some idea of whether this check is now failing for some reason, or whether some code has been added since then that is incompatible with StaticArrays 0.12.5.

I think we should have one last version of ArrayInterface using StaticArrays 0.12.5, and then drop support for it in the next version to avoid problems like this.

1 Like

Hi Elrod,

I don’t know how to help here. Just started with Julia. My problem was solved by removing packages that prevented updating Makie and CairoMakie. Versions having the issue are: Makie 0.10.0 and CairoMakie 0.2.4