# How to automatically add dependencies?

**URL:** <https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508>\
**Category:** New to Julia\
**Created:** [February 12, 2023, 11:37am UTC](https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508 "2023-02-12T11:37:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![baizhan](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Post date:** [February 12, 2023, 11:37am UTC](https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508/1 "2023-02-12T11:37:39Z")

</div>

I have written a small package, and uploaded it to github: [Bai-Zhan/GluonModel](https://github.com/Bai-Zhan/GluonModel)

I have also written another package, which depends on this `GluonModel` package: [Bai-Zhan/ColdDSE](https://github.com/Bai-Zhan/ColdDSE).

Now I want to install the `ColdDSE` package in a clean environment with

```julia
] add https://github.com/Bai-Zhan/ColdDSE.git

```

I would expect that it will also install the `GluonModel` package since it is in the dependency list of `ColdDSE`. However, there appears an error message reading:

```julia
ERROR: Unsatisfiable requirements detected for package GluonModel [168114fb]:
 GluonModel [168114fb] log:
 ├─GluonModel [168114fb] has no known versions!
 └─restricted to versions * by ColdDSE [6af89522] — no versions left
   └─ColdDSE [6af89522] log:
     ├─possible versions are: 0.1.0 or uninstalled
     └─ColdDSE [6af89522] is fixed to version 0.1.0

```

This problem can be solved if I install the `GluonModel` package in advance manually:

```julia
] add https://github.com/Bai-Zhan/GluonModel.git

```

but I hope these dependencies can be installed automatically, since there is likely to be more and more dependencies like this in the future.

How can I fix this problem?

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [February 12, 2023, 1:07pm UTC](https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508/2 "2023-02-12T13:07:57Z")

</div>

Your `Project.toml` file lists no dependencies (and your code does not `import` `ColdDSE` either.

You need to `Pkg.add` or `Pkg.develop` `ColdDSE` (which will then appear in `[deps]` of `Project.toml`.

---

<div class="post-metadata">

**Author:** ![baizhan](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@baizhan](https://discourse.julialang.org/u/baizhan)\
**Post date:** [February 12, 2023, 1:13pm UTC](https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508/3 "2023-02-12T13:13:06Z")

</div>

The Project.toml file of `GluonModel` lists no dependencies because it does not depend on any other package.

The Project.toml file of `ColdDSE` lists several dependencies, which includes the `GluonModel` that I want to automatically install.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [February 12, 2023, 2:38pm UTC](https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508/4 "2023-02-12T14:38:49Z")

</div>

GluonModel is not registered so it cannot be resolved as a dependency. The manifest of the other package is not enough when you `]add`. Not sure what the best practice is for this case. You might consider a private registry if you regularly work with interdependent non-registered packages.

---

<div class="post-metadata">

**Author:** ![cshen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cshen/32/217287_2.png) [@cshen](https://discourse.julialang.org/u/cshen)\
**Post date:** [January 13, 2025, 7:24am UTC](https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508/5 "2025-01-13T07:24:53Z")

</div>

Have you tried with adding `GluonModel` to the sources section in the `ColdSDE` `Project.toml` file? See: [Sources Section](https://pkgdocs.julialang.org/v1/toml-files/#The-%5Bsources%5D-section)

---

<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:** [January 13, 2025, 8:32am UTC](https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508/6 "2025-01-13T08:32:26Z")

</div>

The `sources` section is a new development that wasn’t available when this was discussed two years ago. It can to some extent help with this scenario but is limited in that it’s not resolved recursively, so you can’t link up a tree of unregistered dependencies with it. The most robust solution is still to set up your own registry for the packages which are not registered in General.

---

<div class="post-metadata">

**Author:** ![cshen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cshen/32/217287_2.png) [@cshen](https://discourse.julialang.org/u/cshen)\
**Post date:** [January 13, 2025, 8:40am UTC](https://discourse.julialang.org/t/how-to-automatically-add-dependencies/94508/7 "2025-01-13T08:40:59Z")

</div>

Oh whops, I didn’t mean to necrobump. I saw this thread posted on slack recently and blindly assumed it was recent.
