ITensor and KrylovKit Installation Issue

Hello!

I am trying to set up a new Julia environment to do some GPU testing on my university’s HPC and I am encountering an issue I’ve never seen before. For reference, I am using Julia 1.10.

I create a new environment by doing ] activate --temp and try to do add ITensors. Pkg finds version 0.3.66 and installs it, but then it fails with the following error on precompilation.

julia> err
PkgPrecompileError: The following 1 direct dependency failed to precompile:

ITensors [9136182c-28ba-11e9-034c-db9fb085ebd5]

Failed to precompile ITensors [9136182c-28ba-11e9-034c-db9fb085ebd5] to "/PATH/TO/JULIA/.julia/compiled/v1.10/ITensors/jl_93BImO".
ERROR: LoadError: ArgumentError: Package KrylovKit [0b1a1467-8014-51b9-945f-bf0ae24f4b77] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

I am confused because I would have thought installing ITensor would have brought in all dependencies.

I also tried explicitly adding KrylovKiv by doing ] add KrylovKit@0.7 but then I get the following strange error. I have never seen this before either.

julia> err
PkgPrecompileError: The following 1 direct dependency failed to precompile:

KrylovKit [0b1a1467-8014-51b9-945f-bf0ae24f4b77]

Error: Missing source file for KrylovKit [0b1a1467-8014-51b9-945f-bf0ae24f4b77

Does anyone have any ideas what might be going on here or how to fix it? I am confused because I assumed a fresh environment would usually fix package issues. Is there a problem somehow in .julia/compiled/?

Hello Bob,

I am looking into the issue now, I will let you know. Can you send your Julia versioninfo() please and can you please send the exact script you are using? Thanks!
I have just ran the following command using Pkg; Pkg.activate(temp=true); Pkg.add("ITensors") and I found no issues on my mac M1

julia> versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

I also tried on our linux machines and see no Pkg issue. I have found that creating a fresh environment doesn’t always fix the problem. Can you try removing your registries via this post

Thanks,
Karl

1 Like

Hey @kmp5, thank you for the quick response and taking a look at it. Here is what I get when I do versioninfo() on our login node.

Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 12 × Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, haswell)
  Threads: 1 on 12 virtual cores

If it matters, one thing I tried yesterday was to install packages while in an interactive session on a GPU node. I got some weird errors about curl not working or something? I assumed it was because the GPU node could not talk to the internet or something. Either way I ctrl+C that and exited the node, then added the packages on the login node and I didn’t get the error anymore. But then I get the separate errors I posted about yesterday. I have no idea if the two are related.

As far as exact script - I am doing everything interactively in the REPL. Here is the equivalent in a script form I think.

# mwe.jl
using Pkg
Pkg.add("ITensors")

I create a temporary environment and do include("mwe.jl"). ITensor and all its dependencies are added and then precompilation starts but fails with the messages I gave in yesterday’s post. See below.

I tried deleting and re-adding the registry per the link above but I still get the same error.

(@v1.10) pkg> activate --temp
  Activating new project at `/tmp/jl_YvQR0t`

julia> include("mwe.jl")
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
   Installed HDF5_jll ─ v1.14.3+3
  Downloaded artifact: HDF5
    Updating `/tmp/jl_YvQR0t/Project.toml`
  [9136182c] + ITensors v0.3.66
    Updating `/tmp/jl_YvQR0t/Manifest.toml`
  [7d9f7c33] + Accessors v0.1.36
  [79e6a3ab] + Adapt v4.0.4
  [dce04be8] + ArgCheck v2.3.0
  [4fba245c] + ArrayInterface v7.9.0
  [4c555306] + ArrayLayouts v1.9.1
  [198e06fe] + BangBang v0.4.1
  [9718e550] + Baselet v0.1.1
  [c3b6d118] + BitIntegers v0.3.1
  [8e7c35d0] + BlockArrays v0.16.43
  [d360d2e6] + ChainRulesCore v1.23.0
  [34da2185] + Compat v4.14.0
  [a33af91c] + CompositionsBase v0.1.2
  [187b0558] + ConstructionBase v1.5.5
  [9a962f9c] + DataAPI v1.16.0
  [e2d170a0] + DataValueInterfaces v1.0.0
  [244e2a9f] + DefineSingletons v0.1.2
  [85a47980] + Dictionaries v0.4.1
  [ffbed154] + DocStringExtensions v0.9.3
  [da5c29d0] + EllipsisNotation v1.8.0
  [e2ba6199] + ExprTools v0.1.10
  [e189563c] + ExternalDocstrings v0.1.1
  [1a297f60] + FillArrays v1.10.0
  [41a02a25] + Folds v0.2.10
  [d9f16b24] + Functors v0.4.10
  [46192b85] + GPUArraysCore v0.1.6
  [c27321d9] + Glob v1.3.1
  [f67ccb44] + HDF5 v0.17.2
  [f0d1745a] + HalfIntegers v1.6.0
  [9136182c] + ITensors v0.3.66
  [615f187c] + IfElse v0.1.1
  [313cdc1a] + Indexing v1.1.1
  [22cec73e] + InitialValues v0.3.1
  [842dd82b] + InlineStrings v1.4.0
  [3587e190] + InverseFunctions v0.1.13
  [28f27b66] + IsApprox v0.1.8
  [82899510] + IteratorInterfaceExtensions v1.0.0
  [692b3bcd] + JLLWrappers v1.5.0
  [0b1a1467] + KrylovKit v0.7.1
  [7a12625a] + LinearMaps v3.11.2
  [3da0fdf6] + MPIPreferences v0.1.10
  [1914dd2f] + MacroTools v0.5.13
  [dbb5928d] + MappedArrays v0.4.2
  [128add7d] + MicroCollections v0.2.0
  [23ae76d9] + NDTensors v0.2.30
  [bac558e1] + OrderedCollections v1.6.3
  [9b87118b] + PackageCompiler v2.1.17
  [65ce6f38] + PackageExtensionCompat v1.0.2
  [69de0a69] + Parsers v2.8.1
  [aea7be01] + PrecompileTools v1.2.1
  [21216c6a] + Preferences v1.4.3
  [189a3867] + Reexport v1.2.2
  [42d2dcc6] + Referenceables v0.1.3
  [05181044] + RelocatableFolders v1.0.1
  [ae029012] + Requires v1.3.0
  [6c6a2e73] + Scratch v1.2.1
  [d3ce8812] + SerializedElementArrays v0.1.0
  [efcf1570] + Setfield v1.1.1
  [699a6c99] + SimpleTraits v0.9.4
  [03a91e81] + SplitApplyCombine v1.2.3
  [171d559e] + SplittablesBase v0.1.15
  [aedffcd0] + Static v0.8.10
  [0d7ed370] + StaticArrayInterface v1.5.0
  [90137ffa] + StaticArrays v1.9.3
  [1e83bf80] + StaticArraysCore v1.4.2
  [5e0ebb24] + Strided v2.0.4
  [4db3bf67] + StridedViews v0.2.2
  [3783bdb8] + TableTraits v1.0.1
  [bd369af6] + Tables v1.11.1
  [24d252fe] + ThreadedScans v0.1.0
  [a759f4b9] + TimerOutputs v0.5.23
  [28d57a85] + Transducers v0.4.81
  [9d95972d] + TupleTools v1.5.0
  [409d34a3] + VectorInterface v0.4.4
  [bd1ec220] + Zeros v0.3.0
  [700de1a5] + ZygoteRules v0.2.5
  [0234f1f7] + HDF5_jll v1.14.3+3
  [e33a78d0] + Hwloc_jll v2.10.0+0
  [7cb0a576] + MPICH_jll v4.2.0+0
  [f1f71cc9] + MPItrampoline_jll v5.3.2+0
  [9237b28f] + MicrosoftMPI_jll v10.1.4+2
⌅ [fe0851c0] + OpenMPI_jll v4.1.6+0
  [458c3c95] + OpenSSL_jll v3.0.13+1
  [477f73a3] + libaec_jll v1.1.2+0
  [0dad84c5] + ArgTools v1.1.1
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8ba89e20] + Distributed
  [f43a241f] + Downloads v1.6.0
  [7b1f6079] + FileWatching
  [9fa8497b] + Future
  [b77e0a4c] + InteractiveUtils
  [4af54fe1] + LazyArtifacts
  [b27032c2] + LibCURL v0.6.4
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions v1.2.0
  [44cfe95a] + Pkg v1.10.0
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays v1.10.0
  [4607b0f0] + SuiteSparse
  [fa267f1f] + TOML v1.0.3
  [a4e569a6] + Tar v1.10.0
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v1.0.5+1
  [deac9b47] + LibCURL_jll v8.4.0+0
  [e37daf67] + LibGit2_jll v1.6.4+0
  [29816b5a] + LibSSH2_jll v1.11.0+1
  [c8ffd9c3] + MbedTLS_jll v2.28.2+1
  [14a3606d] + MozillaCACerts_jll v2023.1.10
  [4536629a] + OpenBLAS_jll v0.3.23+2
  [bea87d4a] + SuiteSparse_jll v7.2.1+1
  [83775a58] + Zlib_jll v1.2.13+1
  [8e850b90] + libblastrampoline_jll v5.8.0+1
  [8e850ede] + nghttp2_jll v1.52.0+1
  [3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
Precompiling project...
  ✗ ITensors
  ✗ ITensors → ITensorsVectorInterfaceExt
  3 dependencies successfully precompiled in 55 seconds. 106 already precompiled.
  3 dependencies errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

Did you try running Pkg.instantiate() as the error message in your first post suggested?

Hi @mtfishman ,

Yes I had tried that. I get the following.

(jl_HqCJpQ) pkg> instantiate
  0 dependencies successfully precompiled in 0 seconds. 109 already precompiled. 2 skipped during auto due to previous errors.

You could try deleting your ~/.julia directory, though make sure to make backups of folders like ~/.julia/dev and ~/.julia/config if you’ve been developing packages or have custom startup configurations. (This is considered a “nuclear option”: Danger of deleting .julia? - General Usage - Julia Programming Language but it seems like you’ve tried everything else, I’ve never seen an error message like the one you are seeing.)

Yeah it is strange. I have never seen it either and I have been developing my own package on top of ITensors for 2 years now.

I guess I will do this, hopefully it won’t be disruptive to my workflow and ongoing studies/efforts I have.

The weird thing is that this only happens on my HPC. My laptop and my PC do not have this issue.

Bob,
It looks like from your last post that the problem is no longer related to the Pkg manager and seems to be some precompiling issue. Can you please send the precompiling error trace?

Thanks!
Karl

Hey @kmp5,

Let me know if this is what you meant.

julia> using Pkg

julia> Pkg.precompile()
Precompiling project...
  ✗ ITensors
  ✗ ITensors → ITensorsVectorInterfaceExt
  0 dependencies successfully precompiled in 17 seconds. 109 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

ITensors [9136182c-28ba-11e9-034c-db9fb085ebd5]

Failed to precompile ITensors [9136182c-28ba-11e9-034c-db9fb085ebd5] to "/PATH/TO/HOME/DIR/.julia/compiled/v1.10/ITensors/jl_eSkaLb".
ERROR: LoadError: ArgumentError: Package KrylovKit [0b1a1467-8014-51b9-945f-bf0ae24f4b77] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:
  [1] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1920
  [2] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1806
  [3] #invoke_in_world#3
    @ Base ./essentials.jl:921 [inlined]
  [4] invoke_in_world
    @ Base ./essentials.jl:918 [inlined]
  [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1797
  [6] macro expansion
    @ Base ./loading.jl:1784 [inlined]
  [7] macro expansion
    @ Base ./lock.jl:267 [inlined]
  [8] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1747
  [9] #invoke_in_world#3
    @ Base ./essentials.jl:921 [inlined]
 [10] invoke_in_world
    @ Base ./essentials.jl:918 [inlined]
 [11] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1740
 [12] include(mod::Module, _path::String)
    @ Base ./Base.jl:495
 [13] include(x::String)
    @ ITensors.ITensorMPS ~/.julia/packages/ITensors/c1wvC/src/ITensorMPS/ITensorMPS.jl:1
 [14] top-level scope
    @ ~/.julia/packages/ITensors/c1wvC/src/ITensorMPS/ITensorMPS.jl:18
 [15] include(mod::Module, _path::String)
    @ Base ./Base.jl:495
 [16] include(x::String)
    @ ITensors ~/.julia/packages/ITensors/c1wvC/src/ITensors.jl:51
 [17] top-level scope
    @ ~/.julia/packages/ITensors/c1wvC/src/ITensors.jl:165
 [18] include
    @ Base ./Base.jl:495 [inlined]
 [19] 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, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2216
 [20] top-level scope
    @ stdin:3
in expression starting at /PATH/TO/HOME/DIR/.julia/packages/ITensors/c1wvC/src/ITensorMPS/dmrg.jl:2
in expression starting at /PATH/TO/HOME/DIR/.julia/packages/ITensors/c1wvC/src/ITensorMPS/ITensorMPS.jl:1
in expression starting at /PATH/TO/HOME/DIR/.julia/packages/ITensors/c1wvC/src/ITensors.jl:1
in expression starting at stdin:
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /PATH/TO/HOME/DIR/projects/julia-1.10.0/share/julia/stdlib/v1.10/Pkg/src/Types.jl:70
 [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::@Kwargs{io::Base.TTY})
   @ Pkg.API /PATH/TO/HOME/DIR/projects/julia-1.10.0/share/julia/stdlib/v1.10/Pkg/src/API.jl:1656
 [3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::@Kwargs{})
   @ Pkg.API /PATH/TO/HOME/DIR/projects/julia-1.10.0/share/julia/stdlib/v1.10/Pkg/src/API.jl:159
 [4] precompile(pkgs::Vector{Pkg.Types.PackageSpec})
   @ Pkg.API /PATH/TO/HOME/DIR/projects/julia-1.10.0/share/julia/stdlib/v1.10/Pkg/src/API.jl:148
 [5] precompile(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::@Kwargs{})
   @ Pkg.API /PATH/TO/HOME/DIR/projects/julia-1.10.0/share/julia/stdlib/v1.10/Pkg/src/API.jl:174
 [6] precompile()
   @ Pkg.API /PATH/TO/HOME/DIR/projects/julia-1.10.0/share/julia/stdlib/v1.10/Pkg/src/API.jl:165
 [7] top-level scope
   @ REPL[4]:1

If I do what it recommends and try instantiate then I get the following.

julia> Pkg.instantiate()
  0 dependencies successfully precompiled in 2 seconds. 109 already precompiled. 2 skipped during auto due to previous errors.

I have an update.

On the cluster I went to ~/.julia/packages and did rm -rf KrylovKit.

Then I created a temporary environment and did add KrylovKit and it appeared to work but I got the following warning. I’m not sure what it means or why it occurs.

Precompiling project...
  1 dependency successfully precompiled in 3 seconds. 8 already precompiled.
  1 dependency had output during precompilation:
┌ KrylovKit
│  WARNING: using ChainRulesCore.add!! in module KrylovKit conflicts with an existing identifier.
└  

Now I can compile itensors though, so that appears to be fixed.

Somehow something in the KrylovKit package directory got messed up? Any theories? So that I can avoid this in the future?