Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homebrew's Julia Build is not built correctly and causes package precompilation errors #271

Open
SvenDuve opened this issue Feb 6, 2023 · 34 comments

Comments

@SvenDuve
Copy link

SvenDuve commented Feb 6, 2023

Hello,

I can't precompile DifferentialEquations pointing me to an issue with LinearSolve, and several other packages( Also not pre-compiling: StochasticDiffEq.jl, OrdinaryDiffEq.jl).

I was trying to add the package standalone, and got the following:

julia> using LinearSolve │ Package LinearSolve not found, but a package named LinearSolve is available │ from a registry. │ Install package? │ (@v1.8) pkg> add LinearSolve └ (y/n/o) [y]: y Updating registry at /.julia/registries/General.tomlResolving package versions... Updating/.julia/environments/v1.8/Project.toml[7ed4a6bd] + LinearSolve v1.35.0 No Changes to~/.julia/environments/v1.8/Manifest.toml`
[ Info: Precompiling LinearSolve [7ed4a6bd-45f5-4d41-b270-4a48e9bafcae]
ERROR: LoadError: MethodError: convert(::Type{Union{}}, ::SparseArrays.SparseMatrixCSC{Float64, Int64}) is ambiguous. Candidates:
convert(T::Type{<:LinearAlgebra.Bidiagonal}, m::AbstractMatrix) in LinearAlgebra at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/LinearAlgebra/src/bidiag.jl:203
convert(T::Type{<:SparseArrays.AbstractSparseMatrixCSC}, m::AbstractMatrix) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:745
convert(T::Type{<:LinearAlgebra.SymTridiagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:749
convert(T::Type{<:LinearAlgebra.LowerTriangular}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:753
convert(T::Type{<:SparseArrays.SparseVector}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsevector.jl:466
convert(T::Type{<:LinearAlgebra.Tridiagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:751
convert(T::Type{<:LinearAlgebra.UpperTriangular}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:755
convert(T::Type{<:LinearAlgebra.Diagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:747
convert(::Type{Union{}}, a::AbstractArray) in Base at array.jl:618
convert(::Type{SA}, a::AbstractArray) where SA<:StaticArraysCore.StaticArray in StaticArrays at /Users/svenduve/.julia/packages/StaticArrays/jA1zK/src/convert.jl:194
convert(::Type{T}, a::AbstractArray) where T<:Array in Base at array.jl:617
convert(T::Type{<:BitArray}, a::AbstractArray) in Base at bitarray.jl:580
convert(::Type{T}, M::AbstractArray) where T<:OffsetArrays.OffsetArray in OffsetArrays at /Users/svenduve/.julia/packages/OffsetArrays/TcCEq/src/OffsetArrays.jl:256
convert(::Type{Union{}}, x) in Base at essentials.jl:213
convert(::Type{T}, obj) where T<:FunctionWrappers.FunctionWrapper in FunctionWrappers at /Users/svenduve/.julia/packages/FunctionWrappers/Q5cBx/src/FunctionWrappers.jl:113
convert(::Type{T}, arg) where T<:VecElement in Base at baseext.jl:19
Possible fix, define
convert(::Type{Union{}}, ::SparseArrays.AbstractSparseMatrixCSC)
Stacktrace:
[1] Sparspak.SpkSparseSolver.SparseSolver{Int64, Float64}(p::SparseArrays.SparseMatrixCSC{Float64, Int64}, slvr::Sparspak.SpkSparseBase._SparseBase{Int64, Float64}, n::Int64, ma::Int64, na::Int64, mc::Int64, nc::Int64, _inmatrixdone::Bool, _orderdone::Bool, _symbolicdone::Bool, _factordone::Bool, _trisolvedone::Bool, _refinedone::Bool, _condestdone::Bool) (repeats 2 times)
@ Sparspak.SpkSparseSolver ~/.julia/packages/Sparspak/5cKXy/src/SparseMethod/SpkSparseSolver.jl:18
[2] Sparspak.SpkSparseSolver.SparseSolver(m::SparseArrays.SparseMatrixCSC{Float64, Int64})
@ Sparspak.SparseCSCInterface ~/.julia/packages/Sparspak/5cKXy/src/SparseCSCInterface/SparseCSCInterface.jl:189
[3] sparspaklu(m::SparseArrays.SparseMatrixCSC{Float64, Int64}; factorize::Bool)
@ Sparspak.SparseCSCInterface ~/.julia/packages/Sparspak/5cKXy/src/SparseCSCInterface/SparseCSCInterface.jl:219
[4] init_cacheval(#unused#::LinearSolve.SparspakFactorization, A::SparseArrays.SparseMatrixCSC{Float64, Int64}, b::Vector{Float64}, u::Vector{Float64}, Pl::SciMLOperators.IdentityOperator{4}, Pr::SciMLOperators.IdentityOperator{4}, maxiters::Int64, abstol::Float64, reltol::Float64, verbose::Bool, assumptions::LinearSolve.OperatorAssumptions{true})
@ LinearSolve ~/.julia/packages/LinearSolve/fBayl/src/factorization.jl:514
[5] init(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization; alias_A::Bool, alias_b::Bool, abstol::Float64, reltol::Float64, maxiters::Int64, verbose::Bool, Pl::SciMLOperators.IdentityOperator{4}, Pr::SciMLOperators.IdentityOperator{4}, assumptions::LinearSolve.OperatorAssumptions{true}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ LinearSolve ~/.julia/packages/LinearSolve/fBayl/src/common.jl:117
[6] init(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization)
@ LinearSolve ~/.julia/packages/LinearSolve/fBayl/src/common.jl:88
[7] solve(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ LinearSolve ~/.julia/packages/LinearSolve/fBayl/src/common.jl:157
[8] solve(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization)
@ LinearSolve ~/.julia/packages/LinearSolve/fBayl/src/common.jl:154
[9] macro expansion
@ ~/.julia/packages/LinearSolve/fBayl/src/LinearSolve.jl:102 [inlined]
[10] top-level scope
@ ~/.julia/packages/SnoopPrecompile/1XXT1/src/SnoopPrecompile.jl:62
[11] include
@ ./Base.jl:419 [inlined]
[12] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base ./loading.jl:1554
[13] top-level scope
@ stdin:1
in expression starting at /Users/svenduve/.julia/packages/LinearSolve/fBayl/src/LinearSolve.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile LinearSolve [7ed4a6bd-45f5-4d41-b270-4a48e9bafcae] to /Users/svenduve/.julia/compiled/v1.8/LinearSolve/jl_FFaxJU.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:1707
[3] compilecache
@ ./loading.jl:1651 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144

`

I am on Julia 1.8.5, just updated.

Many thanks.

@ChrisRackauckas
Copy link
Member

Can you share versioninfo()? It looks like it might be the same as https://discourse.julialang.org/t/precompile-error-in-differentialequations-jl/94086/5 and #266, which might only be on Mac M1? So versioninfo() would be helpful because this also looks to be the same, and it looks to be the Homebrew build?

@SvenDuve
Copy link
Author

SvenDuve commented Feb 6, 2023

julia> versioninfo() Julia Version 1.8.5 Commit 17cfb8e65e* (2023-01-08 06:45 UTC) Platform Info: OS: macOS (arm64-apple-darwin22.1.0) CPU: 10 × Apple M1 Pro WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1) Threads: 1 on 8 virtual cores

, and yes its a home-brew build.

is M1 an issue?

@ChrisRackauckas
Copy link
Member

Looks like it might be. I'll need to track down someone who has one. @YingboMa @chriselrod have you experienced this?

@j-fu
Copy link
Contributor

j-fu commented Feb 6, 2023

I found a colleague, he had no problem.

@ChrisRackauckas
Copy link
Member

Was it the homebrew version?

@chriselrod
Copy link
Contributor

chriselrod commented Feb 6, 2023

The error is:

[ Info: Precompiling LinearSolve [7ed4a6bd-45f5-4d41-b270-4a48e9bafcae]
ERROR: LoadError: MethodError: convert(::Type{Union{}}, ::SparseArrays.SparseMatrixCSC{Float64, Int64}) is ambiguous. Candidates:
convert(T::Type{<:LinearAlgebra.Bidiagonal}, m::AbstractMatrix) in LinearAlgebra at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/LinearAlgebra/src/bidiag.jl:203
convert(T::Type{<:SparseArrays.AbstractSparseMatrixCSC}, m::AbstractMatrix) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:745
convert(T::Type{<:LinearAlgebra.SymTridiagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:749
convert(T::Type{<:LinearAlgebra.LowerTriangular}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:753
convert(T::Type{<:SparseArrays.SparseVector}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsevector.jl:466
convert(T::Type{<:LinearAlgebra.Tridiagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:751
convert(T::Type{<:LinearAlgebra.UpperTriangular}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:755
convert(T::Type{<:LinearAlgebra.Diagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:747
convert(::Type{Union{}}, a::AbstractArray) in Base at array.jl:618
convert(::Type{SA}, a::AbstractArray) where SA<:StaticArraysCore.StaticArray in StaticArrays at /Users/svenduve/.julia/packages/StaticArrays/jA1zK/src/convert.jl:194
convert(::Type{T}, a::AbstractArray) where T<:Array in Base at array.jl:617
convert(T::Type{<:BitArray}, a::AbstractArray) in Base at bitarray.jl:580
convert(::Type{T}, M::AbstractArray) where T<:OffsetArrays.OffsetArray in OffsetArrays at /Users/svenduve/.julia/packages/OffsetArrays/TcCEq/src/OffsetArrays.jl:256
convert(::Type{Union{}}, x) in Base at essentials.jl:213
convert(::Type{T}, obj) where T<:FunctionWrappers.FunctionWrapper in FunctionWrappers at /Users/svenduve/.julia/packages/FunctionWrappers/Q5cBx/src/FunctionWrappers.jl:113
convert(::Type{T}, arg) where T<:VecElement in Base at baseext.jl:19
Possible fix, define
convert(::Type{Union{}}, ::SparseArrays.AbstractSparseMatrixCSC)

Union{} looks wrong, so I'll have to check where that came from.

I'm always suspicious of Julia installs that aren't official binaries/from juliaup/built from source.
This at least isn't an error complaining about llvm or a random segfault.

Union{} looks like someone used Base.promote_op/Core.compiler.return_type to pick a type to convert to (or container eltype), but the function signature hit something that does not return/is known to error.
Which maybe could be related.
I'll try on my M1 soon.

@ChrisRackauckas
Copy link
Member

We've got a dev recreating the error, finally 😅😅😅😅😅😅😅😅😅

@j-fu
Copy link
Contributor

j-fu commented Feb 6, 2023

It went well on my colleague's M1 with homebrew 3.6.14.

Yeah Union{} of course looks wrong. It is in an assignement of a struct element declared as

p::Union{Problem{IT, FT},SparseMatrixCSC{FT,IT}}

@chriselrod
Copy link
Contributor

No, I copy/pasted from above to make it readable lol
I don't have a problem with LinearSolve myself...

julia> using LinearSolve
 │ Package LinearSolve not found, but a package named LinearSolve is available from a registry. 
 │ Install package?
 │   (diffeq) pkg> add LinearSolve 
 └ (y/n/o) [y]: 
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
    Updating `~/Documents/progwork/julia/env/diffeq/Project.toml`
  [7ed4a6bd] + LinearSolve v1.35.0
  No Changes to `~/Documents/progwork/julia/env/diffeq/Manifest.toml`

julia> versioninfo()
Julia Version 1.10.0-DEV.501
Commit 2a9f4412a0 (2023-02-05 19:46 UTC)
Platform Info:
  OS: Linux (aarch64-unknown-linux-gnu)
  CPU: 8 × unknown
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 8 on 8 virtual cores
Environment:
  JULIA_PATH = @.
  JULIA_NUM_THREADS = 8

(diffeq) pkg> st -m LinearSolve
Status `~/Documents/progwork/julia/env/diffeq/Manifest.toml`
  [7ed4a6bd] LinearSolve v1.35.0

@ChrisRackauckas
Copy link
Member

...

@chriselrod
Copy link
Contributor

It went well on my colleague's M1 with homebrew 3.6.14.

Yeah Union{} of course looks wrong. It is in an assignement of a struct element declared as

p::Union{Problem{IT, FT},SparseMatrixCSC{FT,IT}}

I can't think of many ways for Union{} to appear, and can't think of any from this. Trying to play with minimal examples, things seem to behave as I'd expect:

julia> struct FooUnion
           x::Union{Float64,Int64}
       end

julia> FooUnion(1f0) # calls convert(::Type{Union{Float64, Int64}}, x::Float32)
ERROR: MethodError: no method matching Union{Float64, Int64}(::Float32)

Closest candidates are:
  (::Type{T})(::T) where T<:Number
   @ Core boot.jl:793
  (::Type{T})(::Base.TwicePrecision) where T<:Number
   @ Base twiceprecision.jl:266
  (::Type{T})(::Complex) where T<:Real
   @ Base complex.jl:44
  ...

Stacktrace:
 [1] convert(#unused#::Type{Union{Float64, Int64}}, x::Float32)
   @ Base ./number.jl:7
 [2] FooUnion(x::Float32)
   @ Main ./REPL[2]:2
 [3] top-level scope
   @ REPL[3]:1

julia> struct FooUnion1
           x::Union{AbstractFloat,Nothing}
``
       end

julia> FooUnion1(1f0)
FooUnion1(1.0f0)

julia> FooUnion1(nothing)
FooUnion1(nothing)

julia> FooUnion1(false) # promotes to float
FooUnion1(0.0)

SparseArrays.SparseMatrixCSC{Float64, Int64}) should have no problem being assigned to a p::Union{Problem{IT, FT},SparseMatrixCSC{FT,IT}} field.

Mind running ] st -m LinearSolve Sparspak?

@j-fu
Copy link
Contributor

j-fu commented Feb 6, 2023

@j-fu
Copy link
Contributor

j-fu commented Feb 6, 2023

Yeah this already goes through all kinds of CI on win/mac(intel)/linux. So this appears really wild to me.

@jredondoyuste
Copy link

Hi! Other person with the issue here: my Homebrew is 3.6.20, that's how I built Julia

@SvenDuve
Copy link
Author

SvenDuve commented Feb 6, 2023

I am on Homebrew 3.6.20 FYI.

I'll remove the Homebrew install and try the official binary now.

@SvenDuve
Copy link
Author

SvenDuve commented Feb 6, 2023

right, that has worked:

julia> versioninfo()

Julia Version 1.8.5 Commit 17cfb8e65ea (2023-01-08 06:45 UTC) Platform Info: OS: macOS (arm64-apple-darwin21.5.0) CPU: 10 × Apple M1 Pro WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1) Threads: 1 on 8 virtual cores

then using the already installed Package...

julia> using LinearSolve

[ Info: Precompiling LinearSolve [7ed4a6bd-45f5-4d41-b270-4a48e9bafcae] ┌ Warning: Replacing docs for 'SciMLOperators.AbstractSciMLOperator :: Union{}' in module 'SciMLOperators' └ @ Base.Docs docs/Docs.jl:240 ┌ Warning: Replacing docs for 'SciMLBase.sol :: Union{Tuple, Tuple{D}, Tuple{S}, Tuple{N}, Tuple{T}} where {T, N, S, D}' in module 'SciMLBase' └ @ Base.Docs docs/Docs.jl:240

@YingboMa
Copy link
Member

YingboMa commented Feb 6, 2023

Is the issue not resolved?

@chriselrod
Copy link
Contributor

Has anyone reported this problem not been on a Homebrew Julia?

Also

[ Info: Precompiling LinearSolve [7ed4a6bd-45f5-4d41-b270-4a48e9bafcae] ┌ Warning: Replacing docs for 'SciMLOperators.AbstractSciMLOperator :: Union{}' in module 'SciMLOperators' └ @ Base.Docs docs/Docs.jl:240

Union{}...?

@YingboMa
Copy link
Member

YingboMa commented Feb 6, 2023

Nothing a little rm -rf ~/.julia/compiled/ cannot fix.

@chriselrod
Copy link
Contributor

Shouldn't their old compiled be ignored now that they have a different julia?

@jredondoyuste
Copy link

Uninstalling the Brew build and installing from source works for me perfectly fine, now :)

thanks for the help!

@chriselrod
Copy link
Contributor

Should we just point to everyone running into this to either install an official binary, use juliaup, or build from source?

Supposedly homebrew isn't like some of the bad distributors that ship Julia with unpatched dependencies, so presumably they'd be interested in knowing what's going wrong and fixing it.

@j-fu
Copy link
Contributor

j-fu commented Feb 6, 2023

Guess yes, I understand that the official binary is almost always the better choice (BTW after starting with the openSUSE build fora while)...

OTOH yeah - someone invested in the homebrew stuff might alert them...

EDIT: There seems to be a quite subtle issue behind this. I would understand if this would be floating point stuff and the rounding goes the other direction, but this one isn't. So my gut feeling is that it is really worth to dig down.

@philippemiron
Copy link

Someone knows what's wrong with the Homebrew version? It does look like it's getting the binary from official sources.

https://github.com/Homebrew/homebrew-cask/blob/efbe1ed540f7a51335ff78c8232a3f06835a7cb8/Casks/julia.rb

@Fedster
Copy link

Fedster commented Apr 17, 2023

Does not work for me. Homebrew Julia, some info:

brew --version
Homebrew 4.0.13

julia versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65e* (2023-01-08 06:45 UTC)
Platform Info:
OS: macOS (arm64-apple-darwin22.1.0)
CPU: 10 × Apple M1 Max
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
Threads: 1 on 8 virtual cores

error

using LinearSolve
[ Info: Precompiling LinearSolve [7ed4a6bd-45f5-4d41-b270-4a48e9bafcae]
ERROR: LoadError: MethodError: convert(::Type{Union{}}, ::SparseArrays.SparseMatrixCSC{Float64, Int64}) is ambiguous. Candidates:
convert(T::Type{<:LinearAlgebra.Bidiagonal}, m::AbstractMatrix) in LinearAlgebra at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/LinearAlgebra/src/bidiag.jl:203
convert(T::Type{<:SparseArrays.AbstractSparseMatrixCSC}, m::AbstractMatrix) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:745
convert(T::Type{<:LinearAlgebra.SymTridiagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:749
convert(T::Type{<:LinearAlgebra.LowerTriangular}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:753
convert(T::Type{<:SparseArrays.SparseVector}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsevector.jl:466
convert(T::Type{<:LinearAlgebra.Tridiagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:751
convert(T::Type{<:LinearAlgebra.UpperTriangular}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:755
convert(T::Type{<:LinearAlgebra.Diagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /opt/homebrew/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:747
convert(::Type{Union{}}, a::AbstractArray) in Base at array.jl:618
convert(::Type{T}, M::AbstractArray) where T<:OffsetArrays.OffsetArray in OffsetArrays at /Users/greatsage/.julia/packages/OffsetArrays/TcCEq/src/OffsetArrays.jl:256
convert(::Type{T}, a::AbstractArray) where T<:Array in Base at array.jl:617
convert(::Type{SA}, a::AbstractArray) where SA<:StaticArraysCore.StaticArray in StaticArrays at /Users/greatsage/.julia/packages/StaticArrays/4uslg/src/convert.jl:194
convert(T::Type{<:BitArray}, a::AbstractArray) in Base at bitarray.jl:580
convert(::Type{Union{}}, x) in Base at essentials.jl:213
convert(::Type{T}, obj) where T<:FunctionWrappers.FunctionWrapper in FunctionWrappers at /Users/greatsage/.julia/packages/FunctionWrappers/Q5cBx/src/FunctionWrappers.jl:113
convert(::Type{T}, arg) where T<:VecElement in Base at baseext.jl:19
Possible fix, define
convert(::Type{Union{}}, ::SparseArrays.AbstractSparseMatrixCSC)
Stacktrace:
[1] Sparspak.SpkSparseSolver.SparseSolver{Int64, Float64}(p::SparseArrays.SparseMatrixCSC{Float64, Int64}, slvr::Sparspak.SpkSparseBase._SparseBase{Int64, Float64}, n::Int64, ma::Int64, na::Int64, mc::Int64, nc::Int64, _inmatrixdone::Bool, _orderdone::Bool, _symbolicdone::Bool, _factordone::Bool, _trisolvedone::Bool, _refinedone::Bool, _condestdone::Bool) (repeats 2 times)
@ Sparspak.SpkSparseSolver ~/.julia/packages/Sparspak/oqBYl/src/SparseMethod/SpkSparseSolver.jl:18
[2] Sparspak.SpkSparseSolver.SparseSolver(m::SparseArrays.SparseMatrixCSC{Float64, Int64})
@ Sparspak.SparseCSCInterface ~/.julia/packages/Sparspak/oqBYl/src/SparseCSCInterface/SparseCSCInterface.jl:189
[3] sparspaklu(m::SparseArrays.SparseMatrixCSC{Float64, Int64}; factorize::Bool)
@ Sparspak.SparseCSCInterface ~/.julia/packages/Sparspak/oqBYl/src/SparseCSCInterface/SparseCSCInterface.jl:219
[4] init_cacheval(#unused#::LinearSolve.SparspakFactorization, A::SparseArrays.SparseMatrixCSC{Float64, Int64}, b::Vector{Float64}, u::Vector{Float64}, Pl::IterativeSolvers.Identity, Pr::IterativeSolvers.Identity, maxiters::Int64, abstol::Float64, reltol::Float64, verbose::Bool, assumptions::LinearSolve.OperatorAssumptions{Nothing})
@ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/factorization.jl:514
[5] init(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization; alias_A::Bool, alias_b::Bool, abstol::Float64, reltol::Float64, maxiters::Int64, verbose::Bool, Pl::IterativeSolvers.Identity, Pr::IterativeSolvers.Identity, assumptions::LinearSolve.OperatorAssumptions{Nothing}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/common.jl:117
[6] init(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization)
@ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/common.jl:88
[7] solve(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/common.jl:157
[8] solve(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization)
@ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/common.jl:154
[9] macro expansion
@ ~/.julia/packages/LinearSolve/dxfUd/src/LinearSolve.jl:92 [inlined]
[10] top-level scope
@ ~/.julia/packages/SnoopPrecompile/1XXT1/src/SnoopPrecompile.jl:62
[11] include
@ ./Base.jl:419 [inlined]
[12] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
@ Base ./loading.jl:1554
[13] top-level scope
@ stdin:1
in expression starting at /Users/greatsage/.julia/packages/LinearSolve/dxfUd/src/LinearSolve.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile LinearSolve [7ed4a6bd-45f5-4d41-b270-4a48e9bafcae] to /Users/greatsage/.julia/compiled/v1.8/LinearSolve/jl_WHRT78.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
@ Base ./loading.jl:1707
[3] compilecache
@ ./loading.jl:1651 [inlined]
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1337
[5] _require_prelocked(uuidkey::Base.PkgId)
@ Base ./loading.jl:1200
[6] macro expansion
@ ./loading.jl:1180 [inlined]
[7] macro expansion
@ ./lock.jl:223 [inlined]
[8] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1144

@j-fu
Copy link
Contributor

j-fu commented Apr 17, 2023

Does not work for me. Homebrew Julia, some info:

Did you try on a non-homebrew Julia ? So far it seems that this is a subtle bug of the homebrew build.

@Fedster
Copy link

Fedster commented Apr 17, 2023

Does not work for me. Homebrew Julia, some info:

Did you try on a non-homebrew Julia ? So far it seems that this is a subtle bug of the homebrew build.

Sadly not due to time issues -- I was wondering whether I should try the cask and not the formula

@Fedster
Copy link

Fedster commented Apr 17, 2023

ok, I nuked the whole homebrew, reinstalled the official binary and no problem, so it is homebrew, which is annoying because I like automated update tracking with it.

@oscardssmith
Copy link
Contributor

juliaup gives the automatic update tracking without providing broken versions of Julia.

@ChrisRackauckas ChrisRackauckas changed the title Package not Precompiling Homebrew's Julia Build is not built correctly and causes package precompilation errors Apr 17, 2023
@ChrisRackauckas
Copy link
Member

Fixed the title. Indeed at this point it's not really a question of what the issue is anymore, it's been repeated dozens of times. Julia's Homebrew build doesn't evaluate Julia scripts exactly like the Julia programming language, and whatever language it is is not something this package is written for. Until it's updated to act like the Julia programming language, we highly recommend people install Julia from https://julialang.org/ or use juliaup https://github.com/JuliaLang/juliaup

@philippemiron
Copy link

As I said a few comments above, the brew cast already points to https://julialang-s3.julialang.org/bin/mac/#{arch}/#{version.major_minor}/julia-#{version}-mac#{arch.delete_prefix("x")}.dmg, which I guess is an official source (?).

The full installation is done by the following script:

cask "julia" do
  arch arm: "aarch64", intel: "x64"

  version "1.8.5"
  sha256 arm:   "7f6a23a4a1d864f69e65b1542fd3d1cf324d59c922ac43804b1ba077b9cc475d",
         intel: "22afd5e28a8a809dc7be0bc99cf491391a31af5669b173cf3318e433274148db"

  url "https://julialang-s3.julialang.org/bin/mac/#{arch}/#{version.major_minor}/julia-#{version}-mac#{arch.delete_prefix("x")}.dmg"
  name "Julia"
  desc "Programming language for technical computing"
  homepage "https://julialang.org/"

  livecheck do
    url "https://julialang.org/downloads/"
    regex(/href=.*?julia[._-]v?(\d+(?:\.\d+)+)[._-]mac#{arch.delete_prefix("x")}\.dmg/i)
  end

  app "Julia-#{version.major_minor}.app"
  binary "#{appdir}/Julia-#{version.major_minor}.app/Contents/Resources/julia/bin/julia"

  zap trash: [
    "~/.julia",
    "~/Library/Logs/Julia",
    "~/Library/Preferences/com.github.Julia.plist",
    "~/Library/Preferences/julia.plist",
    "~/Library/Saved Application State/com.github.Julia.savedState",
  ]
end

I think it would be better to add/modify those steps to properly install julia, instead of hoping for people to install it manually from the website.

@Fedster
Copy link

Fedster commented Apr 19, 2023

I removed the 'official' Julia, I then installed Juliaup with homebrew and everything still works, so my problem was somehow caused by the homebrew julia installation.

@philippemiron I see both a Julia formula ('brew install julia') and a Cask ('brew install --cask julia') in homebrew, and it is the julia installed by the formula that seems to be the problem.

@philippemiron
Copy link

Ok that makes more sense. The regular formula is performing many more steps during installation...

@liiyung
Copy link

liiyung commented Jun 13, 2023

Dropping by to say I also encountered this issue, on macOS and M1 chip.

Versions :
Monterey 12.6
brew --version 4.0.22
julia 1.9.0

I initially installed Julia with brew install julia. Having seen this thread, I removed the first install and reinstalled with brew install --cask julia and that seemed to solve the issue. Perhaps it might be good to mention somewhere that brew install julia still causes this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants