[Nix-dev] Patch for pythonPackages.numpy

Marc Weber marco-oweber at gmx.de
Sun Jun 17 17:16:21 CEST 2012


I'm against that patch because it heavy monkey patching does not solving the
problem at the root of the evil. My old NIX_PYTHON_SITES patch does.

Now there is evidence that such a patch is required just to make things
work without additional work.

What does it do? Basically it patches python import code introducing
NIX_PYTHON_SITES which behaves as PYTHON_USER_BASE *but* allows multiple
paths to be passed.

Why isn't my patch in nixpkgs? I tried getting it in but had a rebase
bug that time and due to my job I wasn't able to fix it within 3 days.

So Eelco Dolstra has had no chance but reverting my patch that time -
because those people being active on python stuff didn't believe in its
necessity.

As always there are multiple ways to solve a trouble - its only me
thinking that my solution is the simpler one in the long run because it
solves the trouble at the root instead of monkey patching derivations
later.

You can find the code at:
https://github.com/MarcWeber/nixpkgs
branch experimental/nix-python-sites

This makes all work:
- matplotlib (including gtk gui by passing pygtk)
- virtinst python bindings
- virtmanager (which previously failed finding libraries and failed due
  to virtinst issues)

Note: I haven't tested virtmanager yet, but I consider the window
showing up a success.

What's left? Rewrite existing code to use NIX_PYTHON_SITES such as wicd.

What might be the difference? My code definitely picks up .pth files.
If you use PYTHONPATH only it may not happen. (I haven't reverified it)

If you like it discuss or pick the patch - you can create a patch file
by exporting the top-git branch easily.

Should the env var contain the python version ? eg NIX_PYTHON27_SITES ?
Don't know - python folks decided against it (forgot about the source).

I'd say keep it simple unless required otherwise.

About pygtk: my patch adds a .pth file instead of creating symlinks.
Should have the same effect.

The pygtk.require('2.0') stuff (still found on pygtk documentation)
seems to be no longer used because nobody is using gtk-1.0 anymore.

Marc Weber


More information about the nix-dev mailing list