# How to fix "ERROR: LoadError: ArgumentError: Package X does not have Y in its dependencies:..." when developing package

**URL:** <https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040>\
**Category:** New to Julia\
**Created:** [September 30, 2022, 1:42pm UTC](https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040 "2022-09-30T13:42:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [September 30, 2022, 1:42pm UTC](https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040/1 "2022-09-30T13:42:54Z")

</div>

I am trying to create a new PR for a package (Catalyst) that adds a dependency (MetaGraphs). I run `]dev Catalyst`, and add some code under “.julia/dev/Catalyst/src”, this includes `using MetaGraphs`.

I then create a new julia Script in a new environment (ensuring that the output from  
`]status`  
includes  
` [479239e8] Catalyst v12.3.0`~/.julia/dev/Catalyst`

I then try `using Catalyst`, but get an error:

```julia
[Info: Precompiling Catalyst [479239e8-5488-4da2-87a7-35f2df7eef83]
ERROR: LoadError: ArgumentError: Package Catalyst does not have MetaGraphs 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 Catalyst checked out for development and have
  added MetaGraphs 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 Catalyst
Stacktrace:
 [1] macro expansion
   @ ./loading.jl:1167 [inlined]
 [2] macro expansion
   @ ./lock.jl:223 [inlined]
 [3] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1144
 [4] include
   @ ./Base.jl:419 [inlined]
 [5] 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, UInt64}}, source::String)
   @ Base ./loading.jl:1554
 [6] top-level scope
   @ stdin:1
in expression starting at /home/SLCU/user/.julia/dev/Catalyst/src/Catalyst.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile Catalyst [479239e8-5488-4da2-87a7-35f2df7eef83] to /home/SLCU/user/.julia/compiled/v1.8/Catalyst/jl_Vm90Lm.

```

How do I fix this?

I tried adding

```julia
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"

```

and

```julia
MetaGraphs = "0.7.1"

```

in Catalyst’s Project.toml file (didn’t work). I also tried to

```julia
]activate /.julia/dev/Catalyst
]add MetaGraphs

```

but this didn’t work either, and now I am unsure what to do.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [September 30, 2022, 1:47pm UTC](https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040/2 "2022-09-30T13:47:02Z")

</div>

> [@Torkel](#):
>
> ```julia
> ]activate /.julia/dev/Catalyst
> ]add MetaGraphs
> 
> ```

That is the correct thing to do.

> [@Torkel](#):
>
> ```julia
> - Or, if you have Catalyst checked out for development and have
> added MetaGraphs as a dependency but haven't updated your primary
> environment's manifest file, try `Pkg.resolve()`.
> 
> ```

Did you do this _after_ adding the `Metagraphs` dependency?

---

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [September 30, 2022, 1:58pm UTC](https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040/3 "2022-09-30T13:58:53Z")

</div>

I tried running

```julia
]resolve

```

both having activated the Catalyst environment and the environment where I run the `using Catalyst` command, but neither worked.

---

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [September 30, 2022, 2:03pm UTC](https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040/4 "2022-09-30T14:03:01Z")

</div>

For reference, here is a full workflow:

```julia
(Spatial CRN Modelling) pkg> activate ../.julia/dev/Catalyst/
  Activating project at `~/Desktop/.julia/dev/Catalyst`

(Catalyst) pkg> add MetaGraphs, GraphRecipes
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
  No Changes to `~/Desktop/.julia/dev/Catalyst/Project.toml`
  No Changes to `~/Desktop/.julia/dev/Catalyst/Manifest.toml`

(Catalyst) pkg> resolve
  No Changes to `~/Desktop/.julia/dev/Catalyst/Project.toml`
  No Changes to `~/Desktop/.julia/dev/Catalyst/Manifest.toml`

(Catalyst) pkg> activate .
  Activating project at `~/Desktop/Spatial CRN Modelling`

julia> using Catalyst
[Info: Precompiling Catalyst [479239e8-5488-4da2-87a7-35f2df7eef83]
ERROR: LoadError: ArgumentError: Package Catalyst does not have MetaGraphs 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 Catalyst checked out for development and have
  added MetaGraphs 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 Catalyst

```

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [September 30, 2022, 2:15pm UTC](https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040/5 "2022-09-30T14:15:58Z")

</div>

Resolve must be done in the environment where you do `using`.

This workflow does what I expect should happen:

```julia
$ mkdir /tmp/testenv
$ julia
(@v1.7) pkg> activate /tmp/testenv
(testenv) pkg> dev --local Catalyst
(testenv) pkg> activate Catalyst
(Catalyst) pkg> add MetaGraphs
(Catalyst) pkg> activate /tmp/testenv
(testenv) pkg> st -m
# Does not list MetaGraphs
(testenv) pkg> resolve
# No Changes to `/tmp/testenv/Project.toml`
# Updating `/tmp/testenv/Manifest.toml`
# [5789e2e9] + FileIO v1.15.0
# [033835bb] + JLD2 v0.4.23
# [626554b9] + MetaGraphs v0.7.1
# [3bb67fe8] + TranscodingStreams v0.9.9
(testenv) pkg> st -m
# Does list MetaGraphs

```

---

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [September 30, 2022, 2:32pm UTC](https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040/6 "2022-09-30T14:32:58Z")

</div>

This seems to work, ish, in that MetaGraphs is now listed.

However, I seem to be having another version of Catalyst than what is in my .julia/dev/Catalyst folder. E.g. I check .julia/dev/Catalyst/Project.toml and there is no sign of MetaGraphs. Furthermore, new functions that I added under .julia/dev/Catalyst/Project.toml I cannot reach through `using Catalyst`.

Does this approach really work to update the Catalyst version I am working on a PR for?

---

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [September 30, 2022, 3:53pm UTC](https://discourse.julialang.org/t/how-to-fix-error-loaderror-argumenterror-package-x-does-not-have-y-in-its-dependencies-when-developing-package/88040/7 "2022-09-30T15:53:08Z")

</div>

I opened a new (ubuntu terminal, was in VSCode before), navigated to the Catalyst directory so that I could do

```julia
julia
]activate .
]add MetaGraphs

```

I then restarted the VSCode session and it worked.

Thanks a lot for the help!
