JuliaIO / JLD.jl

Saving and loading julia variables while preserving native types
MIT License
278 stars 55 forks source link

Sparse matrix loading error: "SparseArrays.SparseMatrixCSC{Core.Int8,Core.Int64} does not match currently loaded type" #282

Open emsal0 opened 3 years ago

emsal0 commented 3 years ago

We (me + @grig-guz) are trying to store a (large) CSV dataset into a sparse matrix and subsequently put that in a JLD blob. However we are getting some weird type error when trying to load it again: ERROR: stored type SparseArrays.SparseMatrixCSC{Core.Int8,Core.Int64} does not match currently loaded type

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.3 (2020-11-09)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia> using JLD

julia> load("data_matrices.jld")
┌ Warning: type SparseArrays.SparseMatrixCSC{Core.Int8,Core.Int64} not present in workspace; reconstructing
└ @ JLD ~/.julia/packages/JLD/jeGJb/src/jld_types.jl:697
ERROR: stored type SparseArrays.SparseMatrixCSC{Core.Int8,Core.Int64} does not match currently loaded type
Stacktrace:
 [1] jldatatype(::JLD.JldFile, ::HDF5.HDF5Datatype) at /home/em/.julia/packages/JLD/jeGJb/src/jld_types.jl:723
 [2] read(::JLD.JldDataset) at /home/em/.julia/packages/JLD/jeGJb/src/JLD.jl:367
 [3] read(::JLD.JldFile, ::String) at /home/em/.julia/packages/JLD/jeGJb/src/JLD.jl:343
 [4] #43 at ./array.jl:0 [inlined]
 [5] iterate at ./generator.jl:47 [inlined]
 [6] collect(::Base.Generator{Array{String,1},JLD.var"#43#45"{JLD.JldFile}}) at ./array.jl:686
 [7] (::JLD.var"#42#44")(::JLD.JldFile) at /home/em/.julia/packages/JLD/jeGJb/src/JLD.jl:1246
 [8] jldopen(::JLD.var"#42#44", ::String, ::Vararg{String,N} where N; kws::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/em/.julia/packages/JLD/jeGJb/src/JLD.jl:243
 [9] jldopen(::Function, ::String, ::String) at /home/em/.julia/packages/JLD/jeGJb/src/JLD.jl:241
 [10] load(::FileIO.File{FileIO.DataFormat{:JLD}}) at /home/em/.julia/packages/JLD/jeGJb/src/JLD.jl:1245
 [11] load(::String; options::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/em/.julia/packages/FileIO/wN5rD/src/loadsave.jl:133
 [12] load(::String) at /home/em/.julia/packages/FileIO/wN5rD/src/loadsave.jl:133
 [13] top-level scope at REPL[2]:1
 [14] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

julia>

The following script is how we package it up

import Pkg; Pkg.add("CSV"); Pkg.add("DataFrames"); Pkg.add("JLD")
using CSV
using DataFrames
using SparseArrays
using JLD

# Data is in the format Item-User-Rating-Timestamp
frame = CSV.read("../data/data.csv", header=["item", "user", "rating", "time_stamp"], DataFrame)

unique_items = unique(frame[!, "item"])
unique_users = unique(frame[!, "user"])

# String id to numerical id
items_map = Dict(zip(unique_items, range(1, length=length(unique_items))))
users_map = Dict(zip(unique_users, range(1, length=length(unique_users))))

num_rows = nrow(frame)
I = zeros(Int64, num_rows); J = zeros(Int64, num_rows); V = ones(Int8, num_rows)
V_ratings= convert(Array{Int8,1}, frame[!, "rating"])

for (index, row) in enumerate(eachrow(frame))
    I[index] = items_map[row["item"]]
    J[index] =  users_map[row["user"]]
end

Sigma = sparse(I, J, V)
B = sparse(I, J, V_ratings)

save("../data/data_matrices.jld", "sigma", Sigma, "b", B)
jmert commented 3 years ago

Can you show the output of st -m from the Pkg REPL?

I'm going to guess you're using JLD with HDF5 v0.13.6 and HDF5_jll v1.12.0. I may have debugged a way to fix the problem, though I still don't understand why it shows up with HDF5_jll v1.12 and not v1.10.

In the mean time, try forcing HDF5 to v0.13.7 which should downgrade HDF5_jll back to v1.10.5+7, and see if that helps.

emsal0 commented 3 years ago
Status `~/.julia/environments/v1.5/Manifest.toml`
  [621f4979] AbstractFFTs v0.5.0
  [1520ce14] AbstractTrees v0.3.3
  [79e6a3ab] Adapt v2.3.0
  [ec485272] ArnoldiMethod v0.0.4
  [7d9fca2a] Arpack v0.4.0
  [68821587] Arpack_jll v3.5.0+3
  [4fba245c] ArrayInterface v2.13.7
  [4c555306] ArrayLayouts v0.3.8
  [56f22d72] Artifacts v1.3.0
  [bf4720bc] AssetRegistry v0.1.0
  [c52e3926] Atom v0.12.21
  [13072b0f] AxisAlgorithms v1.0.0
  [39de3d68] AxisArrays v0.4.3
  [ab4f0b2a] BFloat16s v0.1.0
  [6e4b80f9] BenchmarkTools v0.5.0
  [b99e7846] BinaryProvider v0.5.10
  [a134a8b2] BlackBoxOptim v0.5.0
  [8e7c35d0] BlockArrays v0.12.11
  [a74b3585] Blosc v0.7.0
  [0b7ba130] Blosc_jll v1.14.3+1
  [6e34b625] Bzip2_jll v1.0.6+5
  [fa961155] CEnum v0.4.1
  [a9c8d775] CPUTime v1.0.0
  [00ebfdb7] CSTParser v2.5.0
  [336ed68f] CSV v0.7.7
  [052768ef] CUDA v2.3.0
  [49dc2e85] Calculus v0.5.1
  [aafaddc9] CatIndices v0.2.1
  [324d7699] CategoricalArrays v0.8.3
  [082447d4] ChainRules v0.7.33
  [d360d2e6] ChainRulesCore v0.9.19
  [cdddcdb0] ChainRulesTestUtils v0.5.3
  [53a63b46] CodeTools v0.7.1
  [da1fd8a2] CodeTracking v1.0.5
  [523fee87] CodecBzip2 v0.7.2
  [944b1d66] CodecZlib v0.7.0
  [35d6a980] ColorSchemes v3.10.1
  [3da002f7] ColorTypes v0.10.9
  [c3611d14] ColorVectorSpace v0.8.7
  [5ae59095] Colors v0.12.4
  [a80b9123] CommonMark v0.6.4
  [bbf7d656] CommonSubexpressions v0.3.0
  [34da2185] Compat v3.23.0
  [e66e0078] CompilerSupportLibraries_jll v0.3.4+0
  [ed09eef8] ComputationalResources v0.3.2
  [8f4d0f93] Conda v1.5.0
  [88cd18e8] ConsoleProgressMonitor v0.1.2
  [d38c429a] Contour v0.5.6
  [f65535da] Convex v0.13.7
  [150eb455] CoordinateTransformations v0.6.0
  [adafc99b] CpuId v0.2.2
  [a8cc5b0e] Crayons v4.0.4
  [dc8bdbbb] CustomUnitRanges v1.0.0
  [717857b8] DSP v0.6.9
  [9a962f9c] DataAPI v1.4.0
  [a93c6f00] DataFrames v0.21.7
  [864edb3b] DataStructures v0.18.8
  [e2d170a0] DataValueInterfaces v1.0.0
  [2b5f629d] DiffEqBase v6.48.2
  [459566f4] DiffEqCallbacks v2.14.1
  [01453d9d] DiffEqDiffTools v1.7.0
  [aae7a2af] DiffEqFlux v1.21.0
  [c894b116] DiffEqJump v6.10.1
  [77a26b50] DiffEqNoiseProcess v5.4.2
  [41bf760c] DiffEqSensitivity v6.34.0
  [163ba53b] DiffResults v1.0.2
  [b552c78f] DiffRules v1.0.2
  [b4f34e82] Distances v0.9.2
  [31c24e10] Distributions v0.23.8
  [ced4e74d] DistributionsAD v0.6.11
  [33d173f1] DocSeeker v0.4.2
  [ffbed154] DocStringExtensions v0.8.3
  [e30172f5] Documenter v0.25.4
  [5ae413db] EarCut_jll v2.1.5+1
  [da5c29d0] EllipsisNotation v0.4.0
  [d4d017d3] ExponentialUtilities v1.8.0
  [e2ba6199] ExprTools v0.1.3
  [8f5d6c58] EzXML v1.1.0
  [c87230d0] FFMPEG v0.4.0
  [b22a6f82] FFMPEG_jll v4.3.1+4
  [4f61f5a4] FFTViews v0.3.1
  [7a1cc6ca] FFTW v1.2.4
  [f5851436] FFTW_jll v3.3.9+6
  [9aa1b823] FastClosures v0.3.2
  [5789e2e9] FileIO v1.4.3
  [1a297f60] FillArrays v0.8.14
  [6a86dc24] FiniteDiff v2.7.1
  [26cc04aa] FiniteDifferences v0.11.3
  [53c48c17] FixedPointNumbers v0.8.4
  [08572546] FlameGraphs v0.2.4
  [587475ba] Flux v0.11.2
  [f6369f11] ForwardDiff v0.10.12
  [d7e528f0] FreeType2_jll v2.10.1+5
  [559328eb] FriBidi_jll v1.0.5+6
  [069b7b12] FunctionWrappers v1.1.1
  [de31a74c] FunctionalCollections v0.5.0
  [d9f16b24] Functors v0.1.0
  [fb4132e2] FuzzyCompletions v0.2.6
  [0c68f7d7] GPUArrays v6.1.2
  [61eb1bfa] GPUCompiler v0.8.3
  [28b8d3ca] GR v0.52.0
  [01680d73] GenericSVD v0.3.0
  [5c1252a2] GeometryBasics v0.3.3
  [4d00f742] GeometryTypes v0.8.3
  [a2bd30eb] Graphics v1.0.2
  [42e2da0e] Grisu v1.0.0
  [f67ccb44] HDF5 v0.13.6
  [0234f1f7] HDF5_jll v1.12.0+1
  [cd3eb016] HTTP v0.8.19
  [9fb69e20] Hiccup v0.2.2
  [b5f81e59] IOCapture v0.1.1
  [7869d1d1] IRTools v0.4.1
  [bbac6d45] IdentityRanges v0.3.1
  [2803e5a7] ImageAxes v0.6.7
  [f332f351] ImageContrastAdjustment v0.3.6
  [a09fc81d] ImageCore v0.8.16
  [51556ac3] ImageDistances v0.2.9
  [6a3955dd] ImageFiltering v0.6.16
  [82e4d734] ImageIO v0.3.0
  [6218d12a] ImageMagick v1.1.6
  [c73af94c] ImageMagick_jll v6.9.10-12+3
  [bc367c6b] ImageMetadata v0.9.4
  [787d08f9] ImageMorphology v0.2.9
  [2996bd0c] ImageQualityIndexes v0.1.4
  [4e3cecfd] ImageShow v0.2.3
  [02fcd773] ImageTransformations v0.8.6
  [916415d5] Images v0.22.4
  [9b13fd28] IndirectArrays v0.5.1
  [d25df0c9] Inflate v0.1.2
  [83e8ac13] IniFile v0.5.0
  [1d5cc7b8] IntelOpenMP_jll v2018.0.3+0
  [a98d9a8b] Interpolations v0.12.10
  [8197267c] IntervalSets v0.5.1
  [d8418881] Intervals v1.5.0
  [41ab1584] InvertedIndices v1.0.0
  [c8e1da08] IterTools v1.3.0
  [42fd0dbc] IterativeSolvers v0.8.4
  [82899510] IteratorInterfaceExtensions v1.0.0
  [4138dd39] JLD v0.10.0
  [692b3bcd] JLLWrappers v1.1.3
  [682c06a0] JSON v0.21.1
  [7d188eb4] JSONSchema v0.3.2
  [aacddb02] JpegTurbo_jll v2.0.1+3
  [98e50ef6] JuliaFormatter v0.7.6
  [aa1ae85d] JuliaInterpreter v0.7.26
  [e5e0dc1b] Juno v0.8.3
  [c1c5ebd0] LAME_jll v3.100.0+3
  [929cbde3] LLVM v3.4.0
  [7c4cb9fa] LNR v0.2.1
  [b964fa9f] LaTeXStrings v1.2.0
  [2ee39098] LabelledArrays v1.3.0
  [a5e1c1ea] LatinHypercubeSampling v1.7.3
  [73f95e8e] LatticeRules v0.0.1
  [50d2b5c4] Lazy v0.15.1
  [1d6d02ad] LeftChildRightSiblingTrees v0.1.2
  [deac9b47] LibCURL_jll v7.70.0+2
  [29816b5a] LibSSH2_jll v1.9.0+3
  [dd192d2f] LibVPX_jll v1.9.0+1
  [94ce4f54] Libiconv_jll v1.16.0+7
  [89763e89] Libtiff_jll v4.1.0+2
  [093fc24a] LightGraphs v1.3.0
  [9c8b4983] LightXML v0.9.0
  [d3d80556] LineSearches v7.1.0
  [e6f89c97] LoggingExtras v0.4.2
  [bdcacae8] LoopVectorization v0.8.26
  [5ced341a] Lz4_jll v1.9.2+2
  [856f044c] MKL_jll v2020.2.254+0
  [1914dd2f] MacroTools v0.5.6
  [dbb5928d] MappedArrays v0.2.2
  [b8f27783] MathOptInterface v0.9.18
  [fdba3010] MathProgBase v0.7.8
  [739be429] MbedTLS v1.0.3
  [c8ffd9c3] MbedTLS_jll v2.16.8+1
  [442fdcdd] Measures v0.3.1
  [e89f7d12] Media v0.5.0
  [e1d29d7a] Missings v0.4.4
  [78c3b35d] Mocking v0.7.1
  [e94cdb99] MosaicViews v0.2.4
  [99f44e22] MsgPack v1.1.0
  [46d2c3a1] MuladdMacro v0.2.2
  [d8a4904e] MutableArithmetics v0.2.12
  [d41bc354] NLSolversBase v7.5.0
  [2774e3e8] NLsolve v4.4.1
  [872c559c] NNlib v0.7.7
  [77ba4419] NaNMath v0.3.5
  [0f4fe800] OMJulia v0.1.0
  [510215fc] Observables v0.3.2
  [6fe1bfb0] OffsetArrays v1.4.0
  [e7412a2a] Ogg_jll v1.3.4+2
  [4536629a] OpenBLAS_jll v0.3.9+5
  [458c3c95] OpenSSL_jll v1.1.1+6
  [efe28fd5] OpenSpecFun_jll v0.5.3+4
  [429524aa] Optim v0.22.0
  [91d4177d] Opus_jll v1.3.1+3
  [bac558e1] OrderedCollections v1.3.2
  [1dea7af3] OrdinaryDiffEq v5.45.1
  [90014a1f] PDMats v0.10.1
  [f57f5aa1] PNGFiles v0.3.2
  [5432bcbf] PaddedViews v0.5.7
  [d96e819e] Parameters v0.12.1
  [69de0a69] Parsers v1.0.12
  [fa939f87] Pidfile v1.2.0
  [ccf2f8ad] PlotThemes v2.0.0
  [995b91a9] PlotUtils v1.0.7
  [91a5bcdd] Plots v1.6.5
  [c3e4b0f8] Pluto v0.12.11
  [7f904dfe] PlutoUI v0.6.6
  [e409e4f3] PoissonRandom v0.4.0
  [f27b6e38] Polynomials v1.1.12
  [2dfb63ee] PooledArrays v0.5.3
  [85a6dd25] PositiveFactorizations v0.2.3
  [33c8b6b6] ProgressLogging v0.1.3
  [92933f4c] ProgressMeter v1.4.0
  [438e738f] PyCall v1.92.1
  [d330b81b] PyPlot v2.9.0
  [1fd47b50] QuadGK v2.4.1
  [8a4e6c94] QuasiMonteCarlo v0.2.1
  [74087812] Random123 v1.2.0
  [e6cf234a] RandomNumbers v1.4.0
  [b3c3ace0] RangeArrays v0.3.2
  [c84ed2f1] Ratios v0.4.0
  [3cdcf5f2] RecipesBase v1.1.1
  [01d81517] RecipesPipeline v0.1.13
  [731186ca] RecursiveArrayTools v2.7.2
  [f2c3362d] RecursiveFactorization v0.1.4
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v1.1.1
  [ae5879a3] ResettableStacks v1.0.0
  [37e2e3b7] ReverseDiff v1.4.4
  [708f8203] Richardson v1.2.0
  [79098fc4] Rmath v0.6.1
  [f50d1b31] Rmath_jll v0.2.2+1
  [f2b01f46] Roots v1.0.5
  [6038ab10] Rotations v1.0.1
  [c946c3f1] SCS v0.7.0
  [f4f2fc5b] SCS_jll v2.1.2+1
  [21efa798] SIMDPirates v0.8.26
  [476501e8] SLEEFPirates v0.5.5
  [6c6a2e73] Scratch v1.0.3
  [91c51154] SentinelArrays v1.2.16
  [992d4aef] Showoff v0.3.2
  [699a6c99] SimpleTraits v0.9.3
  [ed01d8cd] Sobol v1.4.0
  [a2af1166] SortingAlgorithms v0.3.1
  [47a9eef4] SparseDiffTools v1.10.1
  [d4ead438] SpatialIndexing v0.1.2
  [276daf66] SpecialFunctions v0.10.3
  [860ef19b] StableRNGs v1.0.0
  [90137ffa] StaticArrays v0.12.5
  [2913bbd2] StatsBase v0.33.1
  [4c63d2b9] StatsFuns v0.9.6
  [8188c328] Stheno v0.6.9
  [789caeaf] StochasticDiffEq v6.26.0
  [88034a9c] StringDistances v0.8.0
  [09ab397b] StructArrays v0.4.4
  [856f2bd8] StructTypes v1.1.0
  [fd094767] Suppressor v0.2.0
  [3783bdb8] TableTraits v1.0.0
  [bd369af6] Tables v1.2.1
  [5d786b92] TerminalLoggers v0.1.2
  [5e47fb64] TestImages v1.2.3
  [06e1c1a7] TiledIteration v0.2.5
  [f269a46b] TimeZones v1.5.1
  [a759f4b9] TimerOutputs v0.5.7
  [0796e94c] Tokenize v0.5.8
  [9f7883ad] Tracker v0.2.12
  [3bb67fe8] TranscodingStreams v0.9.5
  [a2a6695c] TreeViews v0.3.0
  [30578b45] URIParser v0.4.1
  [3a884ed6] UnPack v1.0.2
  [3d5dd08c] VectorizationBase v0.12.33
  [81def892] VersionParsing v1.2.0
  [19fa3120] VertexSafeGraphs v0.1.2
  [8149f6b0] WAV v1.0.3
  [29a6e085] Wavelets v0.9.2
  [0f1e0344] WebIO v0.8.15
  [104b5d7c] WebSockets v1.5.2
  [cc8bc4a8] Widgets v0.6.2
  [efce3f68] WoodburyMatrices v0.5.3
  [02c8fc9c] XML2_jll v2.9.10+3
  [c2297ded] ZMQ v1.2.1
  [8f1865be] ZeroMQ_jll v4.3.2+5
  [a5390f91] ZipFile v0.9.3
  [83775a58] Zlib_jll v1.2.11+18
  [3161d3a3] Zstd_jll v1.4.5+2
  [e88e6eb3] Zygote v0.5.13
  [700de1a5] ZygoteRules v0.2.0
  [0ac62f75] libass_jll v0.14.0+4
  [f638f0a6] libfdk_aac_jll v0.1.6+4
  [b53b4c65] libpng_jll v1.6.37+6
  [f27f6e37] libvorbis_jll v1.3.6+6
  [8e850ede] nghttp2_jll v1.40.0+2
  [1270edf5] x264_jll v2020.7.14+2
  [dfaa095f] x265_jll v3.0.0+3
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [44cfe95a] Pkg
  [de0858da] Printf
  [9abbd945] Profile
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [4607b0f0] SuiteSparse
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
jmert commented 3 years ago

Please retry with the newly tagged JLD v0.11. I expect that will have fixed your problem.

pjuangph commented 3 years ago

I am seeing the same issue. Whenever JLD loads a file, the type that it loads is not the same type that it's saved with.

jmert commented 3 years ago

Can you give a minimal test case to demonstrate the error? In particular, have you loaded the package which defines the type prior to loading the file? For instance, I can get a warning and a unique type by not loading the SparseArrays package before loading a SparseMatrixCSC which was saved in a prior session.

Generate data file

$ julia1.6 --quiet
julia> using JLD

julia> using SparseArrays

julia> JLD.save("/tmp/sparse.jld", "A", sprand(500, 500, 0.001))

julia> exit()

Load file with SparseArrays loaded

$ julia1.6 --quiet
julia> using JLD

julia> using SparseArrays

julia> JLD.load("/tmp/sparse.jld", "A")
500×500 SparseMatrixCSC{Float64, Int64} with 238 stored entries:
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠌⠀⠀⠀⠐⠀⠀⠈⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠂⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⡀⠀⠐⠀
⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⡀⠀⠀⠀⠀⠀⠀⠀⠀⠒⠀⠀⠀⠀⠀⠀⠐⡀⠐⠀⠀⠀⡀⠁⠀⠀⠀⠂⠀⠈⠂
⢀⠀⠈⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠁⠀⠀⠠⠀⠀⠄⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⡃⡀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠁⠀⠀⠀
⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠂⠈⠀⠀⠀⠀⠂⠠⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠁⠀⠀⠀⠀⠠⠀⠐
⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠄⠀⢀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠈⡀
⠀⢈⠄⠐⠀⠀⠀⠀⠀⠀⠠⠀⠀⡈⠀⠀⠀⠀⠀⠀⠢⠀⠀⠂⡀⠂⠀⠀⠀⠂⢀⠀⠀⠀⠀⠀⠀⠀⠄⠀⡀⠀⠀⠀⠀⠀⠀⠀⠈
⠀⠀⠄⠀⠀⠀⠊⠀⠀⠀⠀⠈⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠄⠄⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀
⠐⠀⠀⠀⠀⠈⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⢁⠀⠀⠀⠀⠀⠀⢤⠂⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠂⠈⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠠⠀⠀⠀⠀⠐⠀⠠
⠀⠀⠈⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠐⠀⠀⠀⠀⠀⠀⠁⠂⠀⠀⠁⠀⠀⠀⠈⠀⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠨⠀⢀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠂⠀⠀⠀⠀⠂⠀⠀⠀⠀⠀⠀⠀⠀⢀⠠⠀⠀⠈⠀⠂⠀⠀
⠀⠀⠈⠀⠐⠀⠀⠀⠀⠀⠂⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠃⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠈⢀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠐⠀⠉⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⡀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠄⡀⡀⠀⠀⠀⠀⠄⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡂⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠂⠀⠄⠈⠐⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠀⠀⠀⠀⠄⡀⠁
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠀⠀⠂
⠀⠀⠀⠀⠀⠀⠐⠀⠢⠀⠀⠀⠀⠀⠀⠀⠀⢐⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⢠⠀⠀⠁⠀⠀⠀⠁⠀⠀⠀
⠀⠀⠀⠀⠐⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠐⠀⠀⠀⠀⠂⠀⠀⠀⠀⠀⠀⢠⠀⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⢀⠀⠀⠀⠀⠀
⡀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⡈⠀⠠⠀⠀⠀⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠠⠀⠀⠐⠀⠀⠀⡀⠀⠁⠀⠠⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠠⢀⠀⠠⠀⠀⠀⠀⠀⠈⠀⠀⠄⠀⠐⠀⠁⠀⠐⠀⠀⠀⠀
⠀⠐⠀⠀⠀⠀⠀⠀⠀⠀⠐⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⠀⠀⠀⠀⠀⠀⠂⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠂⠀⠀⠀⠀
⠀⠀⠀⡀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠄⠀⠀⠀⠀⠊⠀⠀⠀⠀⠐⠀⠄⠀⠀⠀⠀⠀⠀⠁⠀⠠⠀⠀⠀⠂⠀⠀⠀⢀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

julia> exit()

Load without first loading SparseArrays package

$ julia1.6 --quiet
julia> using JLD

julia> JLD.load("/tmp/sparse.jld", "A")
┌ Warning: type SparseArrays.SparseMatrixCSC{Core.Float64,Core.Int64} not present in workspace; reconstructing
└ @ JLD ~/.julia/dev/JLD/src/jld_types.jl:697
JLD.var"##SparseArrays.SparseMatrixCSC{Core.Float64,Core.Int64}#245"(500, 500, [1, 1, 1, 3, 3, 3, 3, 3, 5, 6  …  230, 232, 233, 236, 236, 236, 236, 236, 237, 239], [88, 426, 56, 173, 185, 270, 139, 202, 461, 115  …  21, 8, 103, 26, 118, 328, 357, 126, 87, 195], [0.7953567356972984, 0.0716880289372368, 0.22690937900918873, 0.03390742491283438, 0.29001481465266465, 0.36939444686650447, 0.5474073279227187, 0.8277341470615132, 0.5776754929730707, 0.3565983156745265  …  0.6330306324408845, 0.35275101068114045, 0.5322983156557552, 0.12336164548926853, 0.24739034132488058, 0.5309345691003586, 0.5948351346842831, 0.39039170941233614, 0.4162596311121227, 0.23686677532224243])

julia> exit()
Timeroot commented 3 years ago

I had this issue as well -- appeared to happen whenever I mixed Core.Tuple and Core.Array in the type, e.g. Core.Array{Core.Tuple{Core.Int64, Core.Array{Core.Float64}}}. Updating JLD v0.10.0 ⇒ v0.12.3 in Pkg -- which also triggered an update of many other things, like HDF5 v0.13.6 ⇒ v0.15.5 -- fixed it.