Automatically installing dependencies problem

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

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.

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.

2 Likes

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

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

1 Like

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 :thinking:

Now, after reading the docs , 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.

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.

1 Like

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.

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 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.

1 Like

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.

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:

(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 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

pkg> add DelimitedFiles LinearAlgebra Printf SparseArrays Test

and try again then it works.

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

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