# Is it necessary to install all the packages listed in REQUIRE or Project.toml of a package?

**URL:** <https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165>\
**Category:** General Usage\
**Tags:** question\
**Created:** [August 3, 2020, 4:18am UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165 "2020-08-03T04:18:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken\_Lin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_lin/32/14367_2.png) [@Ken\_Lin](https://discourse.julialang.org/u/Ken_Lin)\
**Post date:** [August 3, 2020, 4:18am UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/1 "2020-08-03T04:18:16Z")

</div>

Hello,

In general, in Julia, if I `add` a package `A` through a URL from github, do I have to also install all the packages listed in the `REQUIRE ` (or maybe `Project.toml`) of `A`, in order to use A normally?

It seems that for some `A`, I can still use it even if I don’t install all the other `REQUIRE` packages by myself. But I have also seen cases where I have to install the exact versions of the packages stated in `REQUIRE` in order to use the original package.

I would appreciate it if someone could explain how this works.

Thanks!

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [August 3, 2020, 5:11am UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/2 "2020-08-03T05:11:05Z")

</div>

`REQUIRE` is deprecated.

If you install a package on a recent Julia version, it will install compatible versions as given by the bounds from `Project.toml` automatically, so that you can use the added package.

However, you will only be able to `using` packages you added, you won’t be able to `using` those dependencies.

If a package is unregistered, it could be that it’s list of required packages is broken. You could file an issue asking them to fix it, or a PR fixing it yourself.  
Some unregistered packages depend on other unregistered packages, meaning those dependencies can’t be installed automatically.

---

<div class="post-metadata">

**Author:** ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)\
**Post date:** [August 3, 2020, 5:59am UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/3 "2020-08-03T05:59:22Z")

</div>

Actually, you can do

```julia
using Foo.Bar

```

where `Bar` is a dependency package.

`?using`

---

<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:** [August 3, 2020, 3:55pm UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/4 "2020-08-03T15:55:45Z")

</div>

You don’t even need to specify where `Bar` is used. Just `using Bar` will work.

---

<div class="post-metadata">

**Author:** ![Ken\_Lin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_lin/32/14367_2.png) [@Ken\_Lin](https://discourse.julialang.org/u/Ken_Lin)\
**Post date:** [August 4, 2020, 3:54am UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/5 "2020-08-04T03:54:13Z")

</div>

> [@Elrod](#):
>
> If you install a package on a recent Julia version, it will install compatible versions as given by the bounds from `Project.toml` automatically, so that you can use the added package.
> 
> However, you will only be able to `using` packages you added, you won’t be able to `using` those dependencies.

Thank you. Are you saying as long as the dependencies of a package are registered, they will be installed automatically when I `add` the package?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [August 4, 2020, 6:19am UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/6 "2020-08-04T06:19:10Z")

</div>

> [@Ken\_Lin](#):
>
> as long as the dependencies of a package are registered

Technically, as being [in a registry you have added](https://julialang.github.io/Pkg.jl/dev/registries/#Adding-registries-1) is sufficient — in practice, for most people this is the General registry.

---

<div class="post-metadata">

**Author:** ![ppreshant](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ppreshant/32/28800_2.png) [@ppreshant](https://discourse.julialang.org/u/ppreshant)\
**Post date:** [September 2, 2021, 4:56am UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/7 "2021-09-02T04:56:30Z")

</div>

Actually just using Bar did not work for me. I had to do the using Foo.Bar version for the dependency package, otherwise I got the error `ArgumentError: Package BioSequences not found in current path:`. The same result with both `using` and `import`.

I was trying to use BioSequences package that was a dependancy of BioAlignments, hence I did not explicitly add the package

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 2, 2021, 8:09am UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/8 "2021-09-02T08:09:43Z")

</div>

> [@ppreshant](#):
>
> I was trying to use BioSequences package that was a dependancy of BioAlignments, hence I did not explicitly add the package

If you require `BioSequences` yourself, you can just `add` it anyway - it will not be downloaded or duplicated again, as it has already been loaded by `BioAlignments`. Only one version of a package will be loaded at any given time. Also makes the intent clearer for people looking at your project later on, since `]st` will show that you do indeed require `BioSequences`. It will also be robust against `BioAlignments` choosing not to use `BioSequences` in the future (unlikely, but possible).

---

<div class="post-metadata">

**Author:** ![ppreshant](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ppreshant/32/28800_2.png) [@ppreshant](https://discourse.julialang.org/u/ppreshant)\
**Post date:** [September 9, 2021, 6:44pm UTC](https://discourse.julialang.org/t/is-it-necessary-to-install-all-the-packages-listed-in-require-or-project-toml-of-a-package/44165/10 "2021-09-09T18:44:54Z")

</div>

> [@Sukera](#):
>
> If you require `BioSequences` yourself, you can just `add` it anyway - it will not be downloaded or duplicated again, as it has already been loaded by `BioAlignments` . Only one version of a package will be loaded at any given time. Also makes the intent clearer for people looking at your project later on, since `]st` will show that you do indeed require `BioSequences` . It will also be robust against `BioAlignments` choosing not to use `BioSequences` in the future (unlikely, but possible).

Ah, I see. Definitely makes sense to add it in case the dependency is removed. Thank you for the explanation!
