[Nix-dev] Question about writing expressions for Python packages

Cillian de Róiste cillian.deroiste at gmail.com
Mon Nov 29 12:38:04 CET 2010


Hi,

I'm having some trouble creating expressions for Python packages, I
think I'm not setting the correct buildInputs or perhaps I need to use
wrapProgram so set the PYTHONPATH correctly, although I may have
simply misunderstood.

For example I've tried to add an expression for IPython to
top-level/python-packages.nix which was something like:

ipython = buildPythonPackage {
    name = "ipython-0.10.1";
    src = fetchurl {
      url = "http://ipython.scipy.org/dist/0.10.1/ipython-0.10.1.tar.gz";
      sha256 = "18zwrg25zn72w4rmcwxzcw11ibgp001fawm2sz189zv86z70fxi2";
    };
  buildInputs = [ readline  ];
    doCheck = false;
}

This installs the package correcly with `nix-env -i python-ipython`
although when I run `ipython` it complains that it cannot find
readline.

I have configured my system python to have readline support:

nixpkgs.config.python = { readlineSupport = true; }

and confirmed it is correct:
>>> readline
<module 'readline' from
'/nix/store/cr75hdfgmdb3m0lxdyakfva2bkv5hg6d-python-2.6.5/lib/python2.6/lib-dynload/readline.so'>

Looking at sys.path for ipython I see that the path to lib-dynload is different:
/nix/store/nk3cihf5x24x3mxmwmg8dkv9g86klgkj-python-2.6.5/lib/python2.6/lib-dynload
and this directory does not contain readline.so

I've tried many variations of buildInputs and attempted to use
wrapProgram to add the path, but I can't figure it out.

I have been trying to create a package for MyPaint which I've also
tripped up on configuring it so that it finds numpy correctly. Perhaps
I have skipped over existing documentation on this.
Any help would be greatly appreciated.

Thanks,
Cillian



More information about the nix-dev mailing list