My script fails at `using`

I don’t understand environments. :worried:

I’ve been avoiding trying to understand them for a while and just using Pkg.add willi-nilli. However, this morning I started getting new and unexpected issues without seeming to have made any changes to anything. This prompted me to investigate the use of environments. I’m now in a world of trouble!

I tried following the very simple instructions here.

I’ve created a new folder and added some packages:

(CityMaps) pkg> status
Status `C:\Users\TGebbels\...\Documents\DCMS Database\CityMaps\Project.toml`
  [336ed68f] CSV v0.10.14
  [35d6a980] ColorSchemes v3.24.0
  [5ae59095] Colors v0.12.10
  [a93c6f00] DataFrames v1.6.1
  [f5a160d5] GeoIO v1.12.13
  [dcc97b0b] GeoStats v0.56.0

In my global environment, I also have:

(@v1.10) pkg> status
Status `C:\Users\TGebbels\.julia\environments\v1.10\Project.toml`
  [6e4b80f9] BenchmarkTools v1.5.0
  [07503c7f] BritishNationalGrid v1.0.0
  [336ed68f] CSV v0.10.14
  [a93c6f00] DataFrames v1.6.1
  [864edb3b] DataStructures v0.18.20
  [e30172f5] Documenter v1.4.0
  [cd3eb016] HTTP v1.10.6
  [682c06a0] JSON v0.21.4
  [0f8b85d8] JSON3 v1.14.0
  [88034a9c] StringDistances v0.11.3
  [856f2bd8] StructTypes v1.10.0
  [5c2747f8] URIs v1.5.1
  [fdbf4ff8] XLSX v0.10.1
  [49080126] ZipArchives v2.1.0
  [a5390f91] ZipFile v0.10.1
  [ade2ca70] Dates
  [de0858da] Printf
  [4ec0a83e] Unicode

My very minimal mwe looks like this:

using GeoStats, GeoIO, CSV, DataFrames, Colors, ColorSchemes

Which generates the following:

ERROR: LoadError: InitError: could not load library "C:\Users\TGebbels\.julia\artifacts\dcd0721a2a49cfb8916395419701035173b57955\bin\libarrow.dll"
The specified procedure could not be found.
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl .\libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl .\libdl.jl:116
  [3] macro expansion
    @ C:\Users\TGebbels\.julia\packages\JLLWrappers\pG9bm\src\products\library_generators.jl:63 [inlined]
  [4] __init__()
    @ Arrow_jll C:\Users\TGebbels\.julia\packages\Arrow_jll\s7Yjm\src\wrappers\x86_64-w64-mingw32-cxx11.jl:17
  [5] run_module_init(mod::Module, i::Int64)
    @ Base .\loading.jl:1134
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base .\loading.jl:1122
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base .\loading.jl:1067
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base .\loading.jl:1581
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1938
 [10] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1812
 [11] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [12] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [13] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1803
 [14] macro expansion
    @ .\loading.jl:1790 [inlined]
 [15] macro expansion
    @ .\lock.jl:267 [inlined]
 [16] __require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1753
 [17] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [18] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [19] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1746
 [20] include(mod::Module, _path::String)
    @ Base .\Base.jl:495
 [21] top-level scope
    @ C:\Users\TGebbels\.julia\packages\JLLWrappers\pG9bm\src\toplevel_generators.jl:192
 [22] include
    @ .\Base.jl:495 [inlined]
 [23] 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::String)
    @ Base .\loading.jl:2222
 [24] top-level scope
    @ stdin:3
during initialization of module Arrow_jll
in expression starting at C:\Users\TGebbels\.julia\packages\GDAL_jll\Djhbc\src\wrappers\x86_64-w64-mingw32-cxx11.jl:17
in expression starting at C:\Users\TGebbels\.julia\packages\GDAL_jll\Djhbc\src\GDAL_jll.jl:2
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile GDAL_jll [a7073274-a066-55f0-b90d-d619367d196c] to "C:\\Users\\TGebbels\\.julia\\compiled\\v1.10\\GDAL_jll\\jl_985E.tmp".
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:2468
  [3] compilecache
    @ .\loading.jl:2340 [inlined]
  [4] (::Base.var"#968#969"{Base.PkgId})()
    @ Base .\loading.jl:1974
  [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:93
  [6] #mkpidlock#6
    @ C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:88 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:111
  [8] #invokelatest#2
    @ .\essentials.jl:894 [inlined]
  [9] invokelatest
    @ .\essentials.jl:889 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base .\loading.jl:2983
 [11] maybe_cachefile_lock
    @ .\loading.jl:2980 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1970
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1812
 [14] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [15] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1803
 [17] macro expansion
    @ .\loading.jl:1790 [inlined]
 [18] macro expansion
    @ .\lock.jl:267 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1753
 [20] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [21] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1746
 [23] include
    @ .\Base.jl:495 [inlined]
 [24] 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::String)
    @ Base .\loading.jl:2222
 [25] top-level scope
    @ stdin:3
in expression starting at C:\Users\TGebbels\.julia\packages\GDAL\hNyuz\src\GDAL.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile GDAL [add2ef01-049f-52c4-9ee2-e494f65e021a] to "C:\\Users\\TGebbels\\.julia\\compiled\\v1.10\\GDAL\\jl_96F7.tmp".
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:2468
  [3] compilecache
    @ .\loading.jl:2340 [inlined]
  [4] (::Base.var"#968#969"{Base.PkgId})()
    @ Base .\loading.jl:1974
  [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:93
  [6] #mkpidlock#6
    @ C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:88 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:111
  [8] #invokelatest#2
    @ .\essentials.jl:894 [inlined]
  [9] invokelatest
    @ .\essentials.jl:889 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base .\loading.jl:2983
 [11] maybe_cachefile_lock
    @ .\loading.jl:2980 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1970
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1812
 [14] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [15] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1803
 [17] macro expansion
    @ .\loading.jl:1790 [inlined]
 [18] macro expansion
    @ .\lock.jl:267 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1753
 [20] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [21] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1746
 [23] include
    @ .\Base.jl:495 [inlined]
 [24] 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::String)
    @ Base .\loading.jl:2222
 [25] top-level scope
    @ stdin:3
in expression starting at C:\Users\TGebbels\.julia\packages\ArchGDAL\lgE4A\src\ArchGDAL.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile ArchGDAL [c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3] to "C:\\Users\\TGebbels\\.julia\\compiled\\v1.10\\ArchGDAL\\jl_9561.tmp".
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:2468
  [3] compilecache
    @ .\loading.jl:2340 [inlined]
  [4] (::Base.var"#968#969"{Base.PkgId})()
    @ Base .\loading.jl:1974
  [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:93
  [6] #mkpidlock#6
    @ C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:88 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:111
  [8] #invokelatest#2
    @ .\essentials.jl:894 [inlined]
  [9] invokelatest
    @ .\essentials.jl:889 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base .\loading.jl:2983
 [11] maybe_cachefile_lock
    @ .\loading.jl:2980 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1970
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1812
 [14] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [15] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1803
 [17] macro expansion
    @ .\loading.jl:1790 [inlined]
 [18] macro expansion
    @ .\lock.jl:267 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1753
 [20] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [21] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1746
 [23] include
    @ .\Base.jl:495 [inlined]
 [24] 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::String)
    @ Base .\loading.jl:2222
 [25] top-level scope
    @ stdin:3
in expression starting at C:\Users\TGebbels\.julia\packages\GeoIO\9iBDe\src\GeoIO.jl:5
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile GeoIO [f5a160d5-e41d-4189-8b61-d57781c419e3] to "C:\\Users\\TGebbels\\.julia\\compiled\\v1.10\\GeoIO\\jl_8A45.tmp".
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:2468
  [3] compilecache
    @ .\loading.jl:2340 [inlined]
  [4] (::Base.var"#968#969"{Base.PkgId})()
    @ Base .\loading.jl:1974
  [5] mkpidlock(f::Base.var"#968#969"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
    @ FileWatching.Pidfile C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:93
  [6] #mkpidlock#6
    @ C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:88 [inlined]
  [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
    @ FileWatching.Pidfile C:\Users\TGebbels\.julia\juliaup\julia-1.10.2+0.x64.w64.mingw32\share\julia\stdlib\v1.10\FileWatching\src\pidfile.jl:111
  [8] #invokelatest#2
    @ .\essentials.jl:894 [inlined]
  [9] invokelatest
    @ .\essentials.jl:889 [inlined]
 [10] maybe_cachefile_lock(f::Base.var"#968#969"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
    @ Base .\loading.jl:2983
 [11] maybe_cachefile_lock
    @ .\loading.jl:2980 [inlined]
 [12] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1970
 [13] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1812
 [14] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [15] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [16] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1803
 [17] macro expansion
    @ .\loading.jl:1790 [inlined]
 [18] macro expansion
    @ .\lock.jl:267 [inlined]
 [19] __require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1753
 [20] #invoke_in_world#3
    @ .\essentials.jl:926 [inlined]
 [21] invoke_in_world
    @ .\essentials.jl:923 [inlined]
 [22] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1746
in expression starting at c:\Users\TGebbels\OneDrive - The National Lottery Community Fund\Documents\DCMS Database\CityMaps\MWE.jl:1

I know I’ve screwed something up and I’m hoping it’s a simple fix. But I’m afraid I don’t know where to start!

1 Like

You didn’t do anything wrong. I get the same error in a new temporary environment.

(@v1.10) pkg> activate --temp
  Activating new project at `C:\Users\nboyer.AIP\AppData\Local\Temp\jl_7RVDrF`

(jl_7RVDrF) pkg> add GeoIO
   Resolving package versions...
    Updating `C:\Users\nboyer.AIP\AppData\Local\Temp\jl_7RVDrF\Project.toml`
  [f5a160d5] + GeoIO v1.12.13
    Updating `C:\Users\nboyer.AIP\AppData\Local\Temp\jl_7RVDrF\Manifest.toml`
.
.
.
Precompiling project...
  ✗ GDAL_jll
  ✗ GDAL
  ✗ ArchGDAL
  ✗ GeoIO
  3 dependencies successfully precompiled in 35 seconds. 271 already precompiled.
  4 dependencies errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

julia> using GeoIO
Precompiling GeoIO
        Info Given GeoIO was explicitly requested, output will be shown live
ERROR: LoadError: InitError: could not load library "C:\Users\nboyer.AIP\.julia\artifacts\dcd0721a2a49cfb8916395419701035173b57955\bin\libarrow.dll"
.
.
.

There seems to be a problem with one of GeoIO’s dependencies. I tracked the issue down to here. You will want to follow that issue for a fix. The current workaround seems to be to add snappy_jll@1.1.10 to your environment.

(jl_7RVDrF) pkg> st
Status `C:\Users\nboyer.AIP\AppData\Local\Temp\jl_7RVDrF\Project.toml`
  [f5a160d5] GeoIO v1.12.13

(jl_7RVDrF) pkg> add snappy_jll@1.1.10
   Resolving package versions...
   Installed snappy_jll ─ v1.1.10+0
  Downloaded artifact: snappy
    Updating `C:\Users\nboyer.AIP\AppData\Local\Temp\jl_7RVDrF\Project.toml`
⌃ [fe1e1685] + snappy_jll v1.1.10+0
    Updating `C:\Users\nboyer.AIP\AppData\Local\Temp\jl_7RVDrF\Manifest.toml`
⌃ [fe1e1685] ↓ snappy_jll v1.2.0+0 ⇒ v1.1.10+0
        Info Packages marked with ⌃ have new versions available and may be upgradable.
Precompiling project...
  5 dependencies successfully precompiled in 40 seconds. 269 already precompiled. 4 skipped during auto due to previous errors.

julia> using GeoIO
Precompiling GeoIO
  4 dependencies successfully precompiled in 59 seconds. 274 already precompiled.

This blog post is my favorite resource on environments.
jkrumbiegel.com - Pkg.jl and Julia Environments for Beginners

4 Likes

What a relief! Thank you so much @Nathan_Boyer!