Is any way to install multiple versions of same package?

#1

The issue is breaking compatibility of new versions of some packages. E.g. HTTP@0.8.0 might be installed by default without version declaring. But it is not compatible with Mux, Atom, WebSockets packages which are requiring HTTP@0.7.1. So, how to keep different versions together in same environment?

0 Likes

#2

The environment itself, that is what you load when using HTTP, can only have one version of HTTP. Every package, however, can individually depend on whatever version of HTTP it wants.

(I’m assuming Julia version >= 0.7 and Pkg3.)

0 Likes

#3

I’m not sure where this misconception comes from but this is not the case: you can only have one version of a given package in an environment. You can, however, have different packages with the same name in different parts of the dependency graph. If you need incompatible versions of HTTP in different programs, try using different environments. If you need them both at the same time, you can’t do that; the solution is to fix the compatibility issues in the packages.

3 Likes

#4

Do you mean multiple environments - different deployments of Julia?

The conception of multiple packages actually is present in Ruby gems/bundler, Java/maven/gradle, etc. I can have multiple versions of same packages and use one of them in different applications. But in Julia I cannot install both HTTP 0.7.1 and 0.8.0. I have two different services. One of them is using HTTP 0.8 directly. Other one is using Mux. But Atom, Mux packages are using HTTP 0.7. So, to make possible to install 0.8 I need to remove all dependencies from 0.7 including 0.7. Next I can install 0.8 but cannot install dependable packages more…

(v1.0) pkg> add HTTP@0.8.0
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package WebSockets [104b5d7c]:
 WebSockets [104b5d7c] log:
 ├─possible versions are: [0.0.1-0.0.6, 0.1.0-0.1.2, 0.2.0-0.2.3, 0.3.0, 0.4.0, 0.5.0, 1.0.0-1.0.3, 1.1.0-1.1.1, 1.2.0] or uninstalled
 ├─restricted by compatibility requirements with Atom [c52e3926] to versions: [0.0.1-0.0.6, 0.1.0-0.1.2, 0.2.0-0.2.3, 0.3.0, 0.4.0, 0.5.0, 1.0.0-1.0.3, 1.1.0-1.1.1, 1.2.0]
 │ └─Atom [c52e3926] log:
 │   ├─possible versions are: [0.1.0-0.1.1, 0.2.0-0.2.1, 0.3.0, 0.4.0-0.4.6, 0.5.0-0.5.10, 0.6.0-0.6.17, 0.7.0-0.7.14] or uninstalled
 │   └─restricted to versions 0.7.14 by an explicit requirement, leaving only versions 0.7.14
 ├─restricted by compatibility requirements with Blink [ad839575] to versions: [1.0.1-1.0.3, 1.1.0-1.1.1, 1.2.0]
 │ └─Blink [ad839575] log:
 │   ├─possible versions are: [0.1.0-0.1.5, 0.2.0-0.2.1, 0.3.0-0.3.5, 0.4.0-0.4.4, 0.5.0-0.5.4, 0.6.0-0.6.2, 0.7.0, 0.8.0-0.8.1, 0.9.0] or uninstalled
 │   └─restricted to versions 0.9.0 by an explicit requirement, leaving only versions 0.9.0
 └─restricted by compatibility requirements with HTTP [cd3eb016] to versions: [0.0.1-0.0.6, 0.1.0-0.1.2, 0.2.0-0.2.3, 0.3.0, 0.4.0, 0.5.0] or uninstalled — no versions left
   └─HTTP [cd3eb016] log:
     ├─possible versions are: [0.0.1-0.0.2, 0.4.0-0.4.3, 0.5.0, 0.5.2-0.5.5, 0.5.7, 0.6.0-0.6.14, 0.7.0-0.7.1, 0.8.0] or uninstalled
     ├─restricted to versions * by Mux [a975b10e], leaving only versions [0.0.1-0.0.2, 0.4.0-0.4.3, 0.5.0, 0.5.2-0.5.5, 0.5.7, 0.6.0-0.6.14, 0.7.0-0.7.1, 0.8.0]
     │ └─Mux [a975b10e] log:
     │   ├─possible versions are: 0.6.1 or uninstalled
     │   └─Mux [a975b10e] is fixed to version 0.6.1
     └─restricted to versions 0.8.0 by an explicit requirement, leaving only versions 0.8.0

May be I don’t understand conception of dependencies here but what is the purpose of Manifest file if I cannot have multiple packages versions (in different runtimes)?

0 Likes

#5

You can absolutely do this in Julia as well. The best approach is probably to do something like this in the top directory of a project:

julia> # press `]` to activate the package REPL mode...

(v1.1) pkg> activate .

(Project1) pkg> add HTTP@0.8

This will create Project.toml and Manifest.toml files in Project1. After that if you run julia --project anywhere inside of that project directory, the initial active project will be Project1 instead of v1.1. In the other project directory, do the same thing but add HTTP 0.7 instead. These are totally separate and independent sets of packages and versions. If you commit the project and manifest files in version control, you’ll have a perfect record of your entire Julia dependency graph for each project.

4 Likes