# How to manage dependencies of developed packages

**URL:** <https://discourse.julialang.org/t/how-to-manage-dependencies-of-developed-packages/25481>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [June 20, 2019, 12:09pm UTC](https://discourse.julialang.org/t/how-to-manage-dependencies-of-developed-packages/25481 "2019-06-20T12:09:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsxfan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bsxfan/32/6914_2.png) [@bsxfan](https://discourse.julialang.org/u/bsxfan)\
**Post date:** [June 20, 2019, 12:09pm UTC](https://discourse.julialang.org/t/how-to-manage-dependencies-of-developed-packages/25481/1 "2019-06-20T12:09:59Z")

</div>

I’m sorry, I tried to read docs and various related discourse posts, but I still can’t figure out how to handle dependencies in developed packages. (I’m using Julia 1.1.1 on windows.)

I am working with an environment that I always `activate` in the package manager before any other package commands, or `using` commands.

I am working with a mixture of publicly available packages and my own packages. The public packages are added to the environment with `add`, while my own packages are added with `develop`. When `using` the developed packages, I get depency warnings. I can make the warnings go away with manual editing of the environment’s `manifest.toml` file, but than only lasts until I add another package, which ovewrwrites my edits, and then I have to do it all over again!

Doing things like `update` and `resolve` in the package manager don’t help.

Please advise: What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [June 20, 2019, 12:13pm UTC](https://discourse.julialang.org/t/how-to-manage-dependencies-of-developed-packages/25481/2 "2019-06-20T12:13:10Z")

</div>

The workflow you describe should work, so it is very difficult to understand what goes wrong without an example that shows this broken behaviour. Perhaps you can construct an example (without the private packages)?

---

<div class="post-metadata">

**Author:** ![bsxfan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bsxfan/32/6914_2.png) [@bsxfan](https://discourse.julialang.org/u/bsxfan)\
**Post date:** [June 20, 2019, 12:47pm UTC](https://discourse.julialang.org/t/how-to-manage-dependencies-of-developed-packages/25481/3 "2019-06-20T12:47:07Z")

</div>

Thanks @fredrikekre for your prompt reply. Since this is not a code problem, but a setup problem, it would be very difficult to reproduce elsewhere.

(The one private package that gives me this problem is really very simple. It imports but a single other package and all it does is to declare a single constant. I doubt there is anything special about my code that would cause the problem.)

But perhaps you could help me understand where the package manager finds the dependency relationships that it writes into the environment’s `manifest.toml` file. Whenever the manifest file is updated, there are _no_ dependencies listed for the developed packages, but for the public packages it does manage to find all dependencies. Does it read the dependencies directly from `using` and `import` statements in the code, or is this information specified (or cached) elsewhere ?

---

<div class="post-metadata">

**Author:** ![bsxfan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bsxfan/32/6914_2.png) [@bsxfan](https://discourse.julialang.org/u/bsxfan)\
**Post date:** [June 20, 2019, 5:39pm UTC](https://discourse.julialang.org/t/how-to-manage-dependencies-of-developed-packages/25481/4 "2019-06-20T17:39:13Z")

</div>

I seem to have found a solution: For each of the (misbehaving) packages in development do:

```julia
julia> cd("MyPackage")  
(MyEnvironment) pkg> activate .
(MyPackage) pkg> add Dependency1 #dependency of MyPackage
(MyPackage) pkg> add Dependency2 #dependency of MyPackage
...
julia> cd("..")
(MyPackage) pkg> activate .
(MyEnvironmentDir) pkg> up MyPackage

```

After doing this, the problem goes away: whenever I do a package manager action that rewrites the environment manifest file, the dependencies of the packages under development are now properly added in the manifest.

I could add that the misbehaving packages did have `project.toml` files, but not `manifest.toml` files. (These project files were originally created by doing `pgk> generate MyPackage`.) After doing the above procedure, each development now also has a manifest file.

_I’m not sure whether the package manager harvests its dependency information from these manifest files, or whether it finds it in the Julia registry, but I’d love to know._

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [June 24, 2019, 8:32am UTC](https://discourse.julialang.org/t/how-to-manage-dependencies-of-developed-packages/25481/5 "2019-06-24T08:32:05Z")

</div>

Only the active environments manifest file is used, so you need to make sure you have added relevant packages to your active environment.

> [@bsxfan](#):
>
> _I’m not sure whether the package manager harvests its dependency information from these manifest files, or whether it finds it in the Julia registry, but I’d love to know._

It depends; if you do e.g. `pkg> add Example` the package manager looks up the name `Example` in the registry and finds its dependencies there. If you do `pkg> add www.mypackage.com` Pkg will find the dependencies there etc.

---

<div class="post-metadata">

**Author:** ![bsxfan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bsxfan/32/6914_2.png) [@bsxfan](https://discourse.julialang.org/u/bsxfan)\
**Post date:** [June 24, 2019, 11:50am UTC](https://discourse.julialang.org/t/how-to-manage-dependencies-of-developed-packages/25481/6 "2019-06-24T11:50:50Z")

</div>

I’m not having a good Julia coding day. I still can’t reliably convince the package manager to see dependecies of packages that I’m developing.

I have just created a new package. It lives only on my disk and is not yet checked into any git repositories. I can manage to add this package to my environment by usignt the `develop` command. But when I want to use that package, it won’t even compile, because whatever i do today, I just can’t convince the package manager to see the dependencies of my new package.

I’m almost ready to give up on Julia modules altogether and to just throw all my Julia code into one huge disorganized junkheap.
