# Cannot run one package extension but the other

**URL:** https://discourse.julialang.org/t/cannot-run-one-package-extension-but-the-other/103051
**Category:** General Usage
**Tags:** package-extensions
**Created:** [August 22, 2023, 2:26am UTC](https://discourse.julialang.org/t/cannot-run-one-package-extension-but-the-other/103051 "2023-08-22T02:26:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)
#### Post date: [August 22, 2023, 2:26am UTC](https://discourse.julialang.org/t/cannot-run-one-package-extension-but-the-other/103051/1 "2023-08-22T02:26:14Z")

</div>

I have the following code [here](https://github.com/MineralsCloud/CrystallographyBase.jl/blob/5f17482e8c85891b20e37a8d83570b8b682a3bb2/ext/PeriodicTableExt.jl), where I define 2 package extensions: `BrillouinSpglibExt` & `PeriodicTableExt`. However, I can run the extension `BrillouinSpglibExt` but not the `PeriodicTableExt`. I met the following errors when running the latter:

```julia
julia> using PeriodicTable

(@v1.10) pkg> activate .
  Activating project at `~/.julia/dev/CrystallographyBase`

julia> using CrystallographyBase
[Info: Precompiling PeriodicTableExt [2e94639d-d7d3-5599-a54d-7c6405eaa55c]
ERROR: LoadError: ArgumentError: Package PeriodicTableExt does not have CrystallographBase in its dependencies:
- You may have a partially installed environment. Try `Pkg.instantiate()`
  to ensure all packages in the environment are installed.
- Or, if you have PeriodicTableExt checked out for development and have
  added CrystallographBase as a dependency but haven't updated your primary
  environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with PeriodicTableExt
Stacktrace:
 [1] macro expansion
   @ Base ./loading.jl:1770 [inlined]
 [2] macro expansion
   @ Base ./lock.jl:267 [inlined]
 [3] __require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1747
 [4] #invoke_in_world#3
   @ Base ./essentials.jl:921 [inlined]
 [5] invoke_in_world
   @ Base ./essentials.jl:918 [inlined]
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1740
 [7] include
   @ Base ./Base.jl:489 [inlined]
 [8] 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
 [9] top-level scope
   @ stdin:3
in expression starting at ~/.julia/dev/CrystallographyBase/ext/PeriodicTableExt.jl:1
in expression starting at stdin:3
┌ Error: Error during loading of extension PeriodicTableExt of CrystallographyBase, use `Base.retry_load_extensions()` to retry.
│ exception =
│ 1-element ExceptionStack:
│ Failed to precompile PeriodicTableExt [2e94639d-d7d3-5599-a54d-7c6405eaa55c] to "~/.julia/compiled/v1.10/PeriodicTableExt/jl_4GNDST".
│ 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
│ @ Base ./loading.jl:2334 [inlined]
│ [4] (::Base.var"#967#968"{Base.PkgId})()
│ @ Base ./loading.jl:1968
│ [5] mkpidlock(f::Base.var"#967#968"{Base.PkgId}, at::String, pid::Int32; kwopts::@Kwargs{stale_age::Int64, wait::Bool})
│ @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:92
│ [6] #mkpidlock#6
│ @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:87 [inlined]
│ [7] trymkpidlock(::Function, ::Vararg{Any}; kwargs::@Kwargs{stale_age::Int64})
│ @ FileWatching.Pidfile ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/FileWatching/src/pidfile.jl:110
│ [8] #invokelatest#2
│ @ Base ./essentials.jl:889 [inlined]
│ [9] invokelatest
│ @ Base ./essentials.jl:884 [inlined]
│ [10] maybe_cachefile_lock(f::Base.var"#967#968"{Base.PkgId}, pkg::Base.PkgId, srcpath::String; stale_age::Int64)
│ @ Base ./loading.jl:2978
│ [11] maybe_cachefile_lock
│ @ Base ./loading.jl:2975 [inlined]
│ [12] _require(pkg::Base.PkgId, env::Nothing)
│ @ Base ./loading.jl:1964
│ [13] __require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│ @ Base ./loading.jl:1806
│ [14] #invoke_in_world#3
│ @ Base ./essentials.jl:921 [inlined]
│ [15] invoke_in_world
│ @ Base ./essentials.jl:918 [inlined]
│ [16] _require_prelocked
│ @ Base ./loading.jl:1797 [inlined]
│ [17] _require_prelocked
│ @ Base ./loading.jl:1796 [inlined]
│ [18] run_extension_callbacks(extid::Base.ExtensionId)
│ @ Base ./loading.jl:1289
│ [19] run_extension_callbacks(pkgid::Base.PkgId)
│ @ Base ./loading.jl:1324
│ [20] run_package_callbacks(modkey::Base.PkgId)
│ @ Base ./loading.jl:1158
│ [21] __require_prelocked(uuidkey::Base.PkgId, env::String)
│ @ Base ./loading.jl:1813
│ [22] #invoke_in_world#3
│ @ Base ./essentials.jl:921 [inlined]
│ [23] invoke_in_world
│ @ Base ./essentials.jl:918 [inlined]
│ [24] _require_prelocked(uuidkey::Base.PkgId, env::String)
│ @ Base ./loading.jl:1797
│ [25] macro expansion
│ @ Base ./loading.jl:1784 [inlined]
│ [26] macro expansion
│ @ Base ./lock.jl:267 [inlined]
│ [27] __require(into::Module, mod::Symbol)
│ @ Base ./loading.jl:1747
│ [28] #invoke_in_world#3
│ @ Base ./essentials.jl:921 [inlined]
│ [29] invoke_in_world
│ @ Base ./essentials.jl:918 [inlined]
│ [30] require(into::Module, mod::Symbol)
│ @ Base ./loading.jl:1740
│ [31] eval
│ @ Core ./boot.jl:383 [inlined]
│ [32] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
│ @ REPL ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:150
│ [33] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
│ @ REPL ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:246
│ [34] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
│ @ REPL ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:231
│ [35] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::Any)
│ @ REPL ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:389
│ [36] run_repl(repl::REPL.AbstractREPL, consumer::Any)
│ @ REPL ~/.julia/juliaup/julia-1.10.0-beta2+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/REPL/src/REPL.jl:375
│ [37] (::Base.var"#1012#1014"{Bool, Bool, Bool})(REPL::Module)
│ @ Base ./client.jl:432
│ [38] #invokelatest#2
│ @ Base ./essentials.jl:887 [inlined]
│ [39] invokelatest
│ @ Base ./essentials.jl:884 [inlined]
│ [40] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
│ @ Base ./client.jl:416
│ [41] exec_options(opts::Base.JLOptions)
│ @ Base ./client.jl:333
│ [42] _start()
│ @ Base ./client.jl:552
└ @ Base loading.jl:1295

```

What is wrong with my package extension implementation?  
It seems to be OK to extension functions defined in my main package `CrystallographyBase` as indicated in the [official documentation](https://pkgdocs.julialang.org/v1/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)).

```julia
julia> versioninfo()
Julia Version 1.10.0-beta2
Commit a468aa198d0 (2023-08-17 06:27 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
  Threads: 1 on 8 virtual cores

```

---

<div class="post-metadata">

### Author: ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)
#### Post date: [August 22, 2023, 2:47am UTC](https://discourse.julialang.org/t/cannot-run-one-package-extension-but-the-other/103051/2 "2023-08-22T02:47:09Z")

</div>

> [@singularitti](#):
>
> `CrystallographBase `

typo?  
CrystallographBase != CrystallographyBase

---

<div class="post-metadata">

### Author: ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)
#### Post date: [August 22, 2023, 2:51am UTC](https://discourse.julialang.org/t/cannot-run-one-package-extension-but-the-other/103051/4 "2023-08-22T02:51:36Z")

</div>

Oh! Sorry, my bad. Now it is fixed. Thank you!
