Using package dependencies


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?


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

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.


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?

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