# Using package dependencies

**URL:** <https://discourse.julialang.org/t/using-package-dependencies/44303>\
**Category:** New to Julia\
**Created:** [August 5, 2020, 2:58am UTC](https://discourse.julialang.org/t/using-package-dependencies/44303 "2020-08-05T02:58:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yarnabrina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yarnabrina/32/16888_2.png) [@yarnabrina](https://discourse.julialang.org/u/yarnabrina)\
**Post date:** [August 5, 2020, 2:58am UTC](https://discourse.julialang.org/t/using-package-dependencies/44303/1 "2020-08-05T02:58:21Z")

</div>

Hi!

I have recently started to learn Julia, so if it’s too basic question, please bear with me.

I’m following **Think Julia**. In Chapter 4, it is teaching turtle graphics and suggested to download the `ThinkJulia` package. I followed the suggested step and it worked fine.

However, I noticed that the `turtle` object itself belongs to `Luxor` package, and I verified by Google search. This was indeed one of the many downloads and installs that happened during installation of `ThinkJulia`. I wanted to plot something new, so I tried to run `using Luxor`. But apparently it is not installed and I have to install it separately.

Based on my experiences in `Python` and `R`, if I install a package which has some dependencies, those dependencies are installed also automatically. Is it different for `Julia`? Or, is it the case that those are installed but not exposed except through the package that was intended to be installed? In the latter case, what happens if I already have a package which is a dependency of some other package, and I’m now trying to install that? Will the same package be installed twice, maybe in different locations and with different exposures?

Thanks.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [August 5, 2020, 3:04am UTC](https://discourse.julialang.org/t/using-package-dependencies/44303/2 "2020-08-05T03:04:29Z")

</div>

to use a package with `using PkgName` u need it to be in your Project.toml, otherwise it’s just an indirect dependency.

Try `]add Luxor`

---

<div class="post-metadata">

**Author:** ![Pbellive](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pbellive/32/3604_2.png) [@Pbellive](https://discourse.julialang.org/u/Pbellive)\
**Post date:** [August 5, 2020, 3:19am UTC](https://discourse.julialang.org/t/using-package-dependencies/44303/3 "2020-08-05T03:19:24Z")

</div>

To expand on @xiaodai’s correct response:

If you install package Foo (by doing `]add Foo` say) and Foo depend on Bar, then Bar will be downloaded but not be added to the list of packages available for direct use in your current environment (these are the packages listed in the environment’s Project.toml file).

If you then want to be able to do `using Bar` in that same environment you still need to do `]add Bar` but doing so won’t re-download Bar. The package manager will see that it has already been downloaded and just use the existing copy. So all the `]add Bar` command does in this case is add the Bar package to your current environment’s Project.toml file.

---

<div class="post-metadata">

**Author:** ![yarnabrina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yarnabrina/32/16888_2.png) [@yarnabrina](https://discourse.julialang.org/u/yarnabrina)\
**Post date:** [August 5, 2020, 3:59am UTC](https://discourse.julialang.org/t/using-package-dependencies/44303/4 "2020-08-05T03:59:58Z")

</div>

I already added `Luxor`, just wanted to know what was going on behind the curtain. Thanks a lot for the explanation.

What I understand is that when `Foo` will be installed, it’ll be added to `Project.toml` (and `Manifest.toml`). The dependencies of it, which re already downloaded, will be added to `Manifest.toml`. If I tried to add one new package, it’ll check in `Manifest.toml` to see whether it’s already downloaded or not. If not, it’ll download. Otherwise, a new entry will be added in `Project.toml`.

Can you please confirm/correct this understanding?

---

<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:** [August 5, 2020, 4:34am UTC](https://discourse.julialang.org/t/using-package-dependencies/44303/5 "2020-08-05T04:34:36Z")

</div>

Yes that’s correct. The entries in Project.toml are the packages that you requested by adding or deving them. The entries in Manifest.toml are the specific versions that these requests were resolved to, plus all dependencies.

As a package you added can easily change its internal dependencies without having to tag a breaking version, allowing `using ThatDependency` would give you a false impression that your project will stay functional as long as you stay within the compat bounds of the requested packages in the Project.toml. So it’s better to disallow that.

What I sometimes do as a quick workaround is `using SomePackage.SomeDependency`
