I am trying to make a new package, using Julia v1.10 on macosx. Coming back to basics and following the tutorial ( 5. Creating Packages · Pkg.jl ), I am running into a precompilation error. (This happens for all external dependencies, whether using using or import).
Steps I followed:
- Open new julia session, go to package mode with
]and then:
generate HelloWorld - Exit, move to new
HelloWorlddirectory, then]and
activate .
add Random, JSON - Edit
src/HelloWorld.jlto add lines:
import Random
import JSON - Try
import HelloWorldor] instantiateproduces the error:
PkgPrecompileError: The following 1 direct dependency failed to precompile:
HelloWorld
Failed to precompile HelloWorld [a7910909-222d-43b5-af01-f98d6d1097cc] to "/Users/me/.julia/compiled/v1.10/HelloWorld/jl_8N6nzx".
ERROR: LoadError: ArgumentError: Package JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] 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:1996
[2] __require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1882
[3] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[4] invoke_in_world
@ ./essentials.jl:923 [inlined]
[5] _require_prelocked(uuidkey::Base.PkgId, env::String)
@ Base ./loading.jl:1873
[6] macro expansion
@ ./loading.jl:1860 [inlined]
[7] macro expansion
@ ./lock.jl:267 [inlined]
[8] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:1823
[9] #invoke_in_world#3
@ ./essentials.jl:926 [inlined]
[10] invoke_in_world
@ ./essentials.jl:923 [inlined]
[11] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1816
[12] include
@ ./Base.jl:495 [inlined]
[13] 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:2292
[14] top-level scope
@ stdin:4
in expression starting at .../HelloWorld/src/HelloWorld.jl:1
in expression starting at stdin:
Am I doing something stupid?
Note: my standard environment is clean (nothing added to v1.10)