Julia Arpack dummy package

There's presently a bug in the Julia Arpack package that prevents installation in certain situations. Based on the number of participants in the bug report, these situations are fairly common.

Frustratingly, it's easy to end up with a frivolous dependency on Arpack which is formally an indirect dependency of something else but won't ever be used. As a concrete example, PDMats uses Arpack for PDSparseMat, and Distributions uses PDMats, but (as far as I can tell) not PDSparseMat. Thus, Distributions requires Arpack to be installed, but doesn't need it to be installed.

Here's how things currently look (in a certain situation), starting from a clean slate with Julia 1.0.0:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
pkg> st
    Status `Project.toml`

pkg> st -m
    Status `Manifest.toml`

pkg> add Distributions
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
  Updating `Project.toml`
  [31c24e10] + Distributions v0.16.4
  Updating `Manifest.toml`
  [7d9fca2a] + Arpack v0.3.0
...

julia> using Distributions
ERROR: LoadError: LoadError: LoadError: LoadError: No deps.jl file could be found. Please try running Pkg.build("Arpack").
Currently, the build command might fail when Julia has been built from source
and the recommendation is to use the official binaries from julialang.org.
For more info see https://github.com/JuliaLinearAlgebra/Arpack.jl/issues/5.

in expression starting at /.../.julia/packages/Arpack/UiiMc/src/Arpack.jl:16
in expression starting at /.../.julia/packages/PDMats/mL7bX/src/pdsparsemat.jl:1
in expression starting at /.../.julia/packages/PDMats/mL7bX/src/PDMats.jl:52
in expression starting at /.../.julia/packages/Distributions/WHjOk/src/Distributions.jl:3

pkg> build Arpack
  Building Arpack → `~/.julia/packages/Arpack/UiiMc/deps/build.log`
┌ Error: Error building `Arpack`: 
│ ┌ Warning: Cannot make sense of autodetected libstdc++ ABI version ('3.4.0')
│ └ @ BinaryProvider ~/.julia/packages/BinaryProvider/1nGWd/src/PlatformNames.jl:622
│ ERROR: LoadError: LibraryProduct(nothing, ["libarpack"], :libarpack, "Prefix(/.../.julia/packages/Arpack/UiiMc/deps/usr)") is not satisfied, cannot generate deps.jl!
│ Stacktrace:
│  [1] error(::String) at ./error.jl:33
│  [2] #write_deps_file#152(::Bool, ::Function, ::String, ::Array{LibraryProduct,1}) at /.../.julia/packages/BinaryProvider/1nGWd/src/Products.jl:408
│  [3] (::getfield(BinaryProvider, Symbol("#kw##write_deps_file")))(::NamedTuple{(:verbose,),Tuple{Bool}}, ::typeof(write_deps_file), ::String, ::Array{LibraryProduct,1}) at ./none:0
│ in expression starting at /.../.julia/packages/Arpack/UiiMc/deps/build.jl:74
└ @ Pkg.Operations /.../usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1068

If we need Arpack to be usingable, but nothing else beyond that, we can make a dummy package that is Arpack in name only. Needless to say, this is an ugly hack that is liable to ruin your day some time long after you've forgotten all about it. For now, though, it might get you through the day, so we'll do it anyway.

Making the package

Starting from an empty directory /path/to/dummy, we make two files:

1
2
3
4
/path/to/dummy
├── Project.toml
└── src
    └── Arpack.jl

One is /path/to/dummy/Project.toml:

1
2
name = "Arpack"
uuid = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"

and the other is /path/to/dummy/src/Arpack.jl:

1
module Arpack end

All that remains is to point Julia at this package. The easy way is to say

1
2
pkg> develop /path/to/dummy
pkg> rm Arpack

The second command removes Arpack from Project.toml, but leaves it in Manifest.toml. See below for the marginally harder way if this doesn't work.

Now you should have

1
2
3
4
5
6
7
8
9
pkg> st -m
    Status `Manifest.toml`
  [7d9fca2a] Arpack v0.3.0+ [`/path/to/dummy`]
...

julia> using Distributions

julia> Normal()
Normal{Float64}(μ=0.0, σ=1.0)

Much better!

Manual editing

The marginally harder way involves editing Manifest.toml by hand. The actual file to edit will depend on which environment is currently active. You can check its path by running

1
pkg> st -m

If you haven't activated anything and are working in the default environment, the file will likely be ~/.julia/environments/v1.0/Manifest.toml, but it's probably a good idea (relatively speaking, in the scope of this endeavour) to only do this trickery in a dedicated environment.

Once you've identified the file, look for the Arpack section:

1
2
3
4
5
[[Arpack]]
deps = [...]
git-tree-sha1 = "..."
uuid = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
version = "..."

Replace the git-tree-sha1 with the path to your new package:

1
2
3
4
5
[[Arpack]]
deps = [...]
path = "/path/to/dummy"
uuid = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
version = "..."

This should give you

1
2
3
4
5
6
7
8
9
pkg> st -m
    Status `Manifest.toml`
  [7d9fca2a] Arpack v0.3.0 [`/path/to/dummy`]
...

julia> using Distributions

julia> Normal()
Normal{Float64}(μ=0.0, σ=1.0)

Workaround enabled!