# Automatically installing dependencies problem

**URL:** <https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105>\
**Category:** General Usage\
**Created:** [January 25, 2019, 6:48pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105 "2019-01-25T18:48:18Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [January 25, 2019, 6:48pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/1 "2019-01-25T18:48:18Z")

</div>

Hi!  
I have an unregistered package that includes a REQUIRE file with some dependencies as StatsBase, JSON, etc.  
It works fine, the problem is when I install my package in another machine by using

```julia
pkg> add https://github.com/NumSoftware/FemMesh

```

the dependencies are not automatically installed. Thus I have to install them manually typing: add Package1 add Package2 … etc.

Am I missing something?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 25, 2019, 7:12pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/2 "2019-01-25T19:12:02Z")

</div>

Works for me (`pkg> test FemMesh` passes after adding it). Are you maybe referring to the fact that you can’t do e.g. `using StatsBase` from the REPL if you’ve only added FemMesh? In which case, yes, you have to add those packages to your environment explicitly if you want to use them directly.

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 26, 2019, 6:28am UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/3 "2019-01-26T06:28:23Z")

</div>

Actually, I’m curious, how do people here feel about stuff like `using FemMesh.StatsBase`?

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [January 26, 2019, 7:36am UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/4 "2019-01-26T07:36:45Z")

</div>

If you depend on a API, why not declare that dependency?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [January 26, 2019, 8:30am UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/5 "2019-01-26T08:30:04Z")

</div>

I like this architecture. It can get confusing but it helps to solve dependency issues, where you have some package (e.g. FemMesh) which depends on some older version of another package (e.g. StatsBase v0.27.0) but you also need the newest version of this old one (e.g. StatsBase v1.0).

Actually I only hope that this is the case, I didn’t test it, if it works like that. Is this the solution of the dependency hell or is this dependency hell v2.0? I strongly believe its the first 🤔

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [January 26, 2019, 8:47am UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/6 "2019-01-26T08:47:31Z")

</div>

Now, after reading the [docs](https://julialang.github.io/Pkg.jl/v1/) , my faith in the julia creators was just approved (as always):

> Since environments are managed and updated independently from each other, “dependency hell” is significantly alleviated in Pkg.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [January 26, 2019, 6:04pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/7 "2019-01-26T18:04:17Z")

</div>

No, it’s still not possible to have multiple versions of a package installed in the same environment, at least not yet. You can, however, have packages A and B which depend on different packages that happen to share the same name C.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [January 26, 2019, 7:27pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/8 "2019-01-26T19:27:01Z")

</div>

Two packages with same name C, how is this different to package C in Version 1 and Package C in Version 2? Isn’t that exactly two diffferent Packages with same name C? Surely I am missing a detail.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [January 26, 2019, 7:50pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/9 "2019-01-26T19:50:21Z")

</div>

That’s a very reasonable interpretation, it’s just not how the system currently works. In Julia 1.0, a package has a unique ID (UUID) which uniquely and globally identifies it and distinguishes it from any other packages with the same name. You can see these UUIDs in the Project.toml file. Given a particular package and its UUID, however, you cannot currently have multiple versions of that package installed in one environment.

You could, of course, fork a package named `Foo` and create a new package named `Foo2` if you wanted both `Foo` and `Foo2` to be available in the same environment, but I wouldn’t recommend it unless it’s absolutely necessary. Packages like [Compat.jl](https://github.com/JuliaLang/Compat.jl/blob/master/src/Compat.jl) are a nice demonstration of how Julia’s flexibility makes it possible to be “more compatible” with a wide range of dependencies (or Julia versions) than you could be in other programming languages.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [January 26, 2019, 9:05pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/10 "2019-01-26T21:05:48Z")

</div>

Ok, I understand, it has not yet the complete flexibility built in, but it seems that there is much more possible with a little effort to find work arounds. I am thinking here of my problems with R (specific version), CRAN packages (specific versions) and bioconductor on top with again specific versions and dependencies (this topic is my nemesis it seems). Together with packages written in C it is sometimes nearly impossible to bring all needed tools into one R environment.

---

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [February 6, 2019, 2:03pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/11 "2019-02-06T14:03:55Z")

</div>

Thanks for the answer. Indeed it is working ok for FemMesh. I tested with another unregistered package called Amaru and I got the following error:

```julia
(v1.1) pkg> add https://github.com/NumSoftware/Amaru
  Updating git-repo `https://github.com/NumSoftware/Amaru`
[ Info: Assigning UUID 68281456-d7ce-5e5a-b7a0-5e8bda4b7efe to Amaru
 Resolving package versions...
ERROR: The following package names could not be resolved:
 * DelimitedFiles (8bb1440f-4735-579b-a4ab-409b98df4dab in manifest but not in project)
 * LinearAlgebra (37e2e46d-f89d-539d-b4ee-838fcccc9c8e in manifest but not in project)
 * Printf (de0858da-6303-5e67-8744-51eddeeeb8d7 in manifest but not in project)
 * SparseArrays (2f01184e-e22b-5df5-ae63-d93ebab69eaf in manifest but not in project)
 * Test (8dfed614-e22c-5e08-85e1-65c5234f0b40 in manifest but not in project)
Please specify by known `name=uuid`.

```

my REQUIRE file contains:

```julia
julia 1.0

Printf
LinearAlgebra
SparseArrays
Test
DelimitedFiles

FemMesh
Reexport
JSON
DataStructures
Arpack

```

Note that (unregistered) FemMesh is a dependency but was previously installed.

If I add manually the missing packages by

```julia
pkg> add DelimitedFiles LinearAlgebra Printf SparseArrays Test

```

and try again then it works.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [February 6, 2019, 2:20pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/12 "2019-02-06T14:20:16Z")

</div>

There is no need for standard libraries in the REQUIRE file.

---

<div class="post-metadata">

**Author:** ![RaulDurand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rauldurand/32/2044_2.png) [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Post date:** [February 6, 2019, 2:24pm UTC](https://discourse.julialang.org/t/automatically-installing-dependencies-problem/20105/13 "2019-02-06T14:24:18Z")

</div>

Thanks a lot!  
May be the error message could be more precise about this.
