[Nix-dev] myEnvFun for IPython with Nix on openSuse host

Andreas Herrmann andreash87 at gmx.ch
Sun Jun 1 16:12:30 CEST 2014


Hi everyone,

I am very new to Nix, so let me apologize in advance if this ends up being
a stupid question.


# First, some back story:

The reason I got interested in Nix is that I am doing scientific computing
on a number of different machines with self-made simulation software.
Hence, I need to keep my development environments in sync on these various
machines. A tiresome task that, so far, I am performing manually. I
understand that Nix is promising to help in such situations.

So, I went ahead and installed Nix in single user mode on my laptop which
is running on openSuse 13.1. That is, I used the install script [1], and
installed Nix under /nix. On the wiki I found a section [2] about managing
development environments, which introduces a thing called myEnvFun. It
worked out for a simple environment to use numpy:

    numpy = pkgs.myEnvFun {
      name = "numpy";
      buildInputs = with pkgs; let p27=python27Packages; in [
        stdenv python
        p27.readline
        p27.numpy
      ];
    };

I've installed it using `nix-env -i env-numpy`, and loaded it using `
load-env-numpy`, and everything seems to work fine.

    $ load-env-numpy
    env-numpy loaded
    $ which python
    /nix/store/qikwsrbsyx59ygcmb36p1rgmfclgg882-python-2.7.6/bin/python
    $ python
    Python 2.7.6 (default, Apr 21 2014, 11:09:09)
    [GCC 4.8.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import numpy.version
    >>> numpy.version.version
    '1.7.1'

However, I would prefer to do develop using the IPython shell. So, I wrote
another environment that encorporates ipython:

    ipython = pkgs.myEnvFun {
      name = "ipython";
      buildInputs = with pkgs; let p27=python27Packages; in [
        stdenv python
        p27.readline
        p27.ipython
        p27.numpy
      ];
    };

Installing it works just fine. Loading the environment on the other hand
doesn't.


# The Problem

I get a huge amount errors about gdk-bug when I load the ipython
environment defined above:

    $ load-env-ipython
    mkdir: cannot create directory ‘/lib/gdk-pixbuf-loaders-2.0/’:
Permission denied
    # repeated 61 times
    mkdir: cannot create directory ‘/lib/gdk-pixbuf-loaders-2.0/’:
Permission denied

/nix/store/1j8nx7r6a7s76hj14b7lgqij7yddmvw2-gdk-pixbuf-2.30.6/nix-support/setup-hook:
line 11: /lib/gdk-pixbuf-loaders-2.0//loaders.cache: No such file or
directory
    mkdir: cannot create directory ‘/lib/gdk-pixbuf-loaders-2.0/’:
Permission denied
    # repeated 17 times
    mkdir: cannot create directory ‘/lib/gdk-pixbuf-loaders-2.0/’:
Permission denied
    env-ipython loaded

Depsite the error messages, the environment seems to work.

    $ ipython
    Python 2.7.6 (default, Apr 21 2014, 11:09:09)
    Type "copyright", "credits" or "license" for more information.

    IPython 2.0.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.

    In [1]: import numpy

    In [2]: numpy.version.version


# My Question

What is going on there? Is this because I'm using Nix on a host OS, instead
of NixOS?
Or, am I just missing some package in the environment? In which case,
shouldn't Nix take care of this, and make sure all dependencies are
available?
One instance of a kind-of missing dependency is already the readline
module. If I don't mention it explicitly in the environment, python is
going to complain about it missing.


Thanks in advance for your help. And also thanks for doing this project in
the first place.

Best regards,

Andreas

[1]: https://nixos.org/nix/install
[2]:
https://nixos.org/wiki/Howto_develop_software_on_nixos#Obtaining_an_Environment_from_a_Custom_Definition
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140601/1eeb208d/attachment.html 


More information about the nix-dev mailing list