Hi, Here is a working example with nix-env :
nix-env -i $(nix-build --expr 'with import <nixpkgs> {}; pkgs.buildEnv { name = "pythons"; ignoreCollisions = true; paths = [ pkgs.python34 pkgs.python35 ]; }') or, to pick the prioritized python version (change the priority value if needed; prioritizing avoids colisions) : nix-env -i $(nix-build --expr 'with import <nixpkgs> {}; pkgs.buildEnv { name = "pythons"; paths = [ (lib.recursiveUpdate pkgs.python34 { meta.priority = 0; }) pkgs.python35 ]; }') oh, and uninstall other pythons before :-). Result (in your shell): $ python3<TAB> /external command/ python3 python3.4-config python3.4m-config python3.5-config python3.5m-config python3.4 python3.4m python3.5 python3.5m python3-config -- Layus. PS: This is probably not the best method to use python, but it may be helpful to have both in your shell. Le 04/08/16 à 20:59, Freddy Rietdijk a écrit : > A method to have access to all interpreters is to create a derivation > that has symbolic links to each of the interpreters and install that > one. But as has been said before nix-shell is the recommended method. > > > > On Thu, Aug 4, 2016 at 2:13 PM, Rok Garbas <r...@garbas.si > <mailto:r...@garbas.si>> wrote: > > for the python development don't use nix-env but create per project > default.nix scripts and use nix-shell. > > make sure you read the python section in nixpkgs manual -> > http://nixos.org/nixpkgs/manual/ <http://nixos.org/nixpkgs/manual/> > > if you're looking to generate nix expressions from requirements.txt > checkout pypi2nix -> https://github.com/garbas/pypi2nix > <https://github.com/garbas/pypi2nix>. also know > that pypi2nix is in early stage - still it is giving good results for > some - and i'm looking for feedback of packages that break since this > is the only way i can fix it. > > > On Thu, Aug 4, 2016 at 2:07 PM, Guillaume Maudoux (Layus) > <layus...@gmail.com <mailto:layus...@gmail.com>> wrote: > > Hi, > > > > I think you are putting your efforts in the wrong direction. > > Nix is not designed to install both python 3.4 and 3.5 in the same > > environment. > > > > What it can do however is cache both in the store, so you can get an > > environment with python 3.4 with > > nix-shell -p python34 > > and an environment with python 3.5 with > > nix-shell -p python35 > > > > Nix can provide you with as many different environments at the > same time. > > You can have a shell with python 3.4 running besides a shell > with python > > 3.5. > > You should however not install both in your default environment > (nix-env > > -i) as it won't work. > > > > May I refer you to > https://nixos.org/wiki/Development_Environments > <https://nixos.org/wiki/Development_Environments> ? > > > > Regards, > > -- Layus. > > > > > > Le 03/08/16 à 16:43, Roland Koebler a écrit : > >> Hi, > >> > >> I think I've now found out (at least partially), although this > could > >> result in a package being installed multiple times. > >> > >>> It appears that the flag setting only works on already > installed packages. > >> Yes, and if I use > >> > >> $ nix-env -i python3-3.5.2 > >> ... > >> $ nix-env --set-flag priority 10 python3-3.5.2 > >> ... > >> $ nix-env -i python3-3.4.5 python3-3.5.2 > >> replacing old ‘python3-3.5.2’ > >> installing ‘python3-3.4.5’ > >> installing ‘python3-3.5.2’ > >> > >> it does not work, since the last command first removes > python3-3.5.2, > >> then probably the flag is lost, and then installs it again. > >> > >>> Also I'm not sure, but even if there are name collisions in > the user > >>> environment, it should still be possible to install both > packages but only > >>> use one of the names, and then create your name alias to the > non-named > >>> package. However I do not know how this can be done. > >> I think I've found out. The following works: > >> > >> $ nix-env -i python3-3.5.2 > >> $ nix-env --set-flag priority 10 python3-3.5.2 > >> $ nix-env -i -P python3-3.4.5 > >> > >> --preserve-installed / -P was the relevant switch. > >> However, this can have some strange side-effects, since -P can > >> cause a package to be installed "multiple times": > >> > >> $ nix-env -i -P python3-3.4.5 > >> ... > >> $ nix-env -i -P python3-3.4.5 > >> ... > >> $ nix-env -i -P python3-3.4.5 > >> ... > >> $ nix-env -q > >> ... > >> python3-3.4.5 > >> python3-3.4.5 > >> python3-3.4.5 > >> python3-3.4.5 > >> ... > >> > >> This could then be "resolved" by: > >> > >> $ nix-env -e python3-3.4.5 > >> uninstalling ‘python3-3.4.5’ > >> uninstalling ‘python3-3.4.5’ > >> uninstalling ‘python3-3.4.5’ > >> uninstalling ‘python3-3.4.5’ > >> $ nix-env -P -i python3-3.4.5 > >> installing ‘python3-3.4.5’ > >> > >> But it still looks strange. > >> Is this intentional? > >> > >> Roland > >> > >> _______________________________________________ > >> nix-dev mailing list > >> nix-dev@lists.science.uu.nl <mailto:nix-dev@lists.science.uu.nl> > >> http://lists.science.uu.nl/mailman/listinfo/nix-dev > <http://lists.science.uu.nl/mailman/listinfo/nix-dev> > > > > _______________________________________________ > > nix-dev mailing list > > nix-dev@lists.science.uu.nl <mailto:nix-dev@lists.science.uu.nl> > > http://lists.science.uu.nl/mailman/listinfo/nix-dev > <http://lists.science.uu.nl/mailman/listinfo/nix-dev> > > > > -- > Rok Garbas > https://garbas.si > _______________________________________________ > nix-dev mailing list > nix-dev@lists.science.uu.nl <mailto:nix-dev@lists.science.uu.nl> > http://lists.science.uu.nl/mailman/listinfo/nix-dev > <http://lists.science.uu.nl/mailman/listinfo/nix-dev> > > > > > _______________________________________________ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev
_______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev