Discussion:
conflicting packages / priority values
(too old to reply)
Roni Choudhury
2017-06-16 23:07:11 UTC
Permalink
From time to time I see an error message like this:

collision between
‘/nix/store/qs8fq5ld2shc0i3fvbs6n0g0k8fypndm-git-2.13.0/bin/git’ and
‘/nix/store/64fjdb4whkf2r5x8xyqf9kkljnk6w59b-git-2.13.0/bin/git’; use
‘nix-env --set-flag priority NUMBER PKGNAME’ to change the priority of
one of the conflicting packages

I understand what causes it (two packages competing to place the same,
e.g., binaries in my profile), but I’ve never understood how to resolve it.
Usually I just guess priority numbers until it works; more lately I’ve
simply removed the offending package from my environment before repeating
the failing install command. Obviously, neither approach is healthy or
correct :)

The man page for nix-env contains the following:

If there are multiple derivations matching a name in args that have the
same name (e.g., gcc-3.3.6 and gcc-4.1.1), then the derivation with the
highest priority is used. A derivation can define a priority by declaring
the meta.priority attribute. This attribute should be a number, with a
higher value denoting a lower priority. The default priority is 0.

But I’m still not sure what this means for my error situation. How do I
know what the priorities are for the different packages? The default value
is 0, which is the highest priority; what does that mean exactly, for the
default priority to be the highest priority?

Is there a more intuitive way to resolve this sort of conflict? For
instance, is there a way to tell nix-env to force the issue by treating the
requested package as higher priority than any existing ones?

Thanks!

roni
​
Roger Qiu
2017-06-17 03:14:06 UTC
Permalink
I wonder in other programming languages, name clashes are usually resolved
through aliasing. Would it be possible for nix to install packages while
aliasing their outputs to a different name to avoid clashes like this?
collision between ‘/nix/store/qs8fq5ld2shc0i3fvbs6n0g0k8fypndm-git-2.13.0/bin/git’ and ‘/nix/store/64fjdb4whkf2r5x8xyqf9kkljnk6w59b-git-2.13.0/bin/git’; use ‘nix-env --set-flag priority NUMBER PKGNAME’ to change the priority of one of the conflicting packages
I understand what causes it (two packages competing to place the same,
e.g., binaries in my profile), but I’ve never understood how to resolve it.
Usually I just guess priority numbers until it works; more lately I’ve
simply removed the offending package from my environment before repeating
the failing install command. Obviously, neither approach is healthy or
correct :)
If there are multiple derivations matching a name in args that have the
same name (e.g., gcc-3.3.6 and gcc-4.1.1), then the derivation with the
highest priority is used. A derivation can define a priority by declaring
the meta.priority attribute. This attribute should be a number, with a
higher value denoting a lower priority. The default priority is 0.
But I’m still not sure what this means for my error situation. How do I
know what the priorities are for the different packages? The default value
is 0, which is the highest priority; what does that mean exactly, for the
default priority to be the highest priority?
Is there a more intuitive way to resolve this sort of conflict? For
instance, is there a way to tell nix-env to force the issue by treating
the requested package as higher priority than any existing ones?
Thanks!
roni
​
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
James Cook
2017-06-17 06:25:29 UTC
Permalink
Roger, I'm not sure what you're suggesting. Do you mean that the user's
configuration would explicitly say "include pkgs.someAlternateGitVersion in
my profile, but rename /bin/git to /bin/gitB"?

As a starting point, I guess you could do that manually by making a new
expression with a build script like cp -r "$git" "$out"; mv "$out/bin/git"
"$out/bin/gitB".
Post by Roger Qiu
I wonder in other programming languages, name clashes are usually resolved
through aliasing. Would it be possible for nix to install packages while
aliasing their outputs to a different name to avoid clashes like this?
collision between ‘/nix/store/qs8fq5ld2shc0i3fvbs6n0g0k8fypndm-git-2.13.0/bin/git’ and ‘/nix/store/64fjdb4whkf2r5x8xyqf9kkljnk6w59b-git-2.13.0/bin/git’; use ‘nix-env --set-flag priority NUMBER PKGNAME’ to change the priority of one of the conflicting packages
I understand what causes it (two packages competing to place the same,
e.g., binaries in my profile), but I’ve never understood how to resolve it.
Usually I just guess priority numbers until it works; more lately I’ve
simply removed the offending package from my environment before repeating
the failing install command. Obviously, neither approach is healthy or
correct :)
If there are multiple derivations matching a name in args that have the
same name (e.g., gcc-3.3.6 and gcc-4.1.1), then the derivation with the
highest priority is used. A derivation can define a priority by declaring
the meta.priority attribute. This attribute should be a number, with a
higher value denoting a lower priority. The default priority is 0.
But I’m still not sure what this means for my error situation. How do I
know what the priorities are for the different packages? The default value
is 0, which is the highest priority; what does that mean exactly, for the
default priority to be the highest priority?
Is there a more intuitive way to resolve this sort of conflict? For
instance, is there a way to tell nix-env to force the issue by treating
the requested package as higher priority than any existing ones?
Thanks!
roni
​
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
Roger Qiu
2017-06-17 07:13:09 UTC
Permalink
Yes something like that but without too much fanfare. A standard nix
function encapsulating this aliasing logic and expose it to user space with
nix-env too.
Post by James Cook
Roger, I'm not sure what you're suggesting. Do you mean that the user's
configuration would explicitly say "include pkgs.someAlternateGitVersion in
my profile, but rename /bin/git to /bin/gitB"?
As a starting point, I guess you could do that manually by making a new
expression with a build script like cp -r "$git" "$out"; mv "$out/bin/git"
"$out/bin/gitB".
Post by Roger Qiu
I wonder in other programming languages, name clashes are usually
resolved through aliasing. Would it be possible for nix to install packages
while aliasing their outputs to a different name to avoid clashes like this?
collision between ‘/nix/store/qs8fq5ld2shc0i3fvbs6n0g0k8fypndm-git-2.13.0/bin/git’ and ‘/nix/store/64fjdb4whkf2r5x8xyqf9kkljnk6w59b-git-2.13.0/bin/git’; use ‘nix-env --set-flag priority NUMBER PKGNAME’ to change the priority of one of the conflicting packages
I understand what causes it (two packages competing to place the same,
e.g., binaries in my profile), but I’ve never understood how to resolve it.
Usually I just guess priority numbers until it works; more lately I’ve
simply removed the offending package from my environment before repeating
the failing install command. Obviously, neither approach is healthy or
correct :)
If there are multiple derivations matching a name in args that have the
same name (e.g., gcc-3.3.6 and gcc-4.1.1), then the derivation with the
highest priority is used. A derivation can define a priority by declaring
the meta.priority attribute. This attribute should be a number, with a
higher value denoting a lower priority. The default priority is 0.
But I’m still not sure what this means for my error situation. How do I
know what the priorities are for the different packages? The default value
is 0, which is the highest priority; what does that mean exactly, for the
default priority to be the highest priority?
Is there a more intuitive way to resolve this sort of conflict? For
instance, is there a way to tell nix-env to force the issue by treating
the requested package as higher priority than any existing ones?
Thanks!
roni
​
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
Layus
2017-06-17 07:57:14 UTC
Permalink
When you get too many such conflicts, you are probably looking for
virtual environments.
These are provided by nix-shell, and allow to temporarilly override the
set of available, installed applications.

Looking at your example, a clash between two different git's at the same
version is very weird...

-- Layus.
Post by Roger Qiu
I wonder in other programming languages, name clashes are usually
resolved through aliasing. Would it be possible for nix to install
packages while aliasing their outputs to a different name to avoid
clashes like this?
|collision between
‘/nix/store/qs8fq5ld2shc0i3fvbs6n0g0k8fypndm-git-2.13.0/bin/git’ and
‘/nix/store/64fjdb4whkf2r5x8xyqf9kkljnk6w59b-git-2.13.0/bin/git’;
use ‘nix-env --set-flag priority NUMBER PKGNAME’ to change the
priority of one of the conflicting packages |
I understand what causes it (two packages competing to place the
same, e.g., binaries in my profile), but I’ve never understood how
to resolve it. Usually I just guess priority numbers until it
works; more lately I’ve simply removed the offending package from
my environment before repeating the failing install command.
Obviously, neither approach is healthy or correct :)
If there are multiple derivations matching a name in args that
have the same name (e.g., gcc-3.3.6 and gcc-4.1.1), then the
derivation with the highest priority is used. A derivation can
define a priority by declaring the meta.priority attribute.
This attribute should be a number, with a higher value
denoting a lower priority. The default priority is 0.
But I’m still not sure what this means for my error situation. How
do I know what the priorities are for the different packages? The
default value is 0, which is the highest priority; what does that
mean exactly, for the default priority to be the highest priority?
Is there a more intuitive way to resolve this sort of conflict?
For instance, is there a way to tell |nix-env| to force the issue
by treating the requested package as higher priority than any
existing ones?
Thanks!
roni
​
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
<https://mailman.science.uu.nl/mailman/listinfo/nix-dev>
_______________________________________________
nix-dev mailing list
https://mailman.science.uu.nl/mailman/listinfo/nix-dev
Loading...