-
-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-implement python-wrapper with buildEnv. #834
Conversation
Interesting, what's the motivation behind this change? |
not sure i like this idea. this will make things impure right? |
@iElectric, I override pythonFull with the @garbas, I'm not sure what you mean by "impure" in this context. Could you please explain your concern in a little more detail? |
Not really sure how that works, but you would override What we are trying to avoid is pythonFull picking up modules automatically from the system. |
by impure i mean that you will install pythonFull and at first everything is going to work. until something is added to pythonhome and then its stops working or worse it works differently then when you install it. i agree with @iElectric here. we should avoid picking up modules automatically from the system. |
Python does never pick up any modules from the system because of this patch. There is no reason to worry about that. |
This cannot happen. PYTHONHOME points to an immutable store path; nothing is ever going to get added there after the derivation has been built. |
You may want to use propagatedUserEnvPackages instead of buildEnv. That allows the wrapper to propagate packages into the user environment without needing an additional symlink tree. |
Is this a supplement or replacement for #792 ? |
#792 and this patch are orthogonal. There is no relationship between those two. |
@edolstra, the nice thing about |
FYI: I plan to merge this patch in a day or two. |
@peti i'll give a try tonight ... to test that it still works with my existing environments |
this is usual dev.nix file i use to create develpment environment now
and then i run when using your pull request i'm getting the following error
i'm not quite sure how should i change i would really appreciate if you don't merge this until we find some solution for above use-case. i guess also others python developers are using similar way of creating their development environment for their projects. monday and tuesday i'll be travelling to brasil and i'm not sure how much i will be online, but i'll try to reply asap when i get online. |
@garbas, I cannot re-produce the error you reported. This is a build of your expression using the current
And this is the same build run in the current
Both work fine. What I find strange about your build log is that the expression |
The new wrapper creates an environment that contains all files from Python and the extra libraries that have been specified. All files are found at run-time by means of the $PYTHONHOME variable; the wrapper no longer uses $PYTHONPATH.
@garbas, do you still have concerns about this update? |
not sure why it was not working for me that day. works now. |
@garbas, since this patch has been in the queue for 2+ months, I think it's okay to merge it now and deal with issues that might arise once they do arise. If you run into any problems, please let me know! |
Re-implement python-wrapper with buildEnv.
Hi @peti, this seems to have broken the build of |
@shlevy,
You are right, though, that there might be a problem with |
So it turns out that buildEnv just symlinks |
You seem to get a different path, are you using a different nixpkgs/do you have a config.nix? |
@shlevy , yes, you are right -- that is the problem. Python27Full comes with an additional If you have such a patch already, please commit it! |
See discussion in #834 Signed-off-by: Shea Levy <shea@shealevy.com>
I'm having trouble with myEnvFun environments since this merge.
}; at be67ab5, after loading the env I get:
after f6e835a I get:
So, none of the packages in buildInputs or their dependencies are available from the environment. In the earlier revision I noticed that after I run load-env-plone43 I already have all the python modules for that env in $PYTHONPATH, but this is not the case after the merge. @peti do I just need to adjust my myEnvFun expression, or do you know some other solution? |
It confuses matters that I had set PYTHONPATH to /run/current-system/sw/lib/python2.7/site-packages, but now I have unset PYTHONPATH before loading the env, and I have 489 modules in my sys.path for the old version, and 8 in the new version. I'll have a look at myEnvFun to see if I can figure out what's happening. |
I think I get it now:
Which is very nice IMO, and if I'm not mistaken, it's way way faster to start up python too! Thanks @peti! |
Could you also add that to wiki/manual? |
For sure, I'm just doing some testing now, I think I need to work on zc_buildout_nix a bit. |
I guess it's a bit of a hack, but to share the same modules with other python programs included in myEnvFun, you can set PYTHONHOME in extraCmds:
In this example, Otherwise, I don't know how to handle python programs such as IPython. @bjornfor you might be interested to look into this too. |
@iElectric I've updated the relevant section of the wiki: |
The setting
looks odd to me. Python-wrapper sets the $PYTHONHOME variable, so every package that uses the correct python interpreter should have it automaticallly. If there are packages that the python-wrapper cannot find, then they should probably be added to the wrapper's |
Hmm, looking at the wrapped ipython I see that it uses the python binary directly rather than the wrapped version, is that the problem?
Do we need to modify wrapPythonPrograms: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/generic/wrap.sh#L8 or should that already pick up the wrapped python? |
I've never used ipython and I don't know much about it, but I guess |
I guess we should fix wrapPythonPrograms to do this for all python console scripts then, or perhaps there is some way to convince |
…nixpkgs#834 (#14651, 22:04, 8 October 2013)
…nixpkgs#834 (#14651, 22:04, 8 October 2013)
The new wrapper creates an environment that contains all files from
Python and the extra libraries that have been specified. All files are
found at run-time by means of the $PYTHONHOME variable; the wrapper no
longer uses $PYTHONPATH.