Problems importing astropy when running inside Ipython Notebook

I cant get astropy to work in a ipython notebook. `import astropy` works correctly in a normal Ipython session under the same UID. I installed astropy 0.3.2 with pip on Ubuntu 14.04 32 bit.

The first time I import astropy i get this error:

```
/usr/local/lib/python2.7/dist-packages/astropy/config/configuration.py:441: ConfigurationMissingWarning: Configuration defaults will be used, and configuration cannot be saved due to OSError:Could not find unix home directory to search for astropy config dir
  warn(ConfigurationMissingWarning(msg))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-d192094ef7da> in <module>()
----> 1 import astropy

/usr/local/lib/python2.7/dist-packages/astropy/__init__.py in <module>()
    244     log = _init_log()
    245 
--> 246     _initialize_astropy()
    247 
    248     from .utils.misc import find_api_page

/usr/local/lib/python2.7/dist-packages/astropy/__init__.py in _initialize_astropy()
    226 
    227     try:
--> 228         config.configuration.update_default_config(__package__, config_dir)
    229     except config.configuration.ConfigurationDefaultMissingError as e:
    230         wmsg = (e.args[0] + " Cannot install default profile. If you are "

/usr/local/lib/python2.7/dist-packages/astropy/config/configuration.pyc in update_default_config(pkg, default_cfg_dir_or_fn)
    693     cfgfn = get_config(pkg).filename
    694 
--> 695     if path.exists(cfgfn):
    696         with open(cfgfn) as f:
    697             doupdate = f.read() == ''

/usr/lib/python2.7/genericpath.pyc in exists(path)
     16     """Test whether a path exists.  Returns False for broken symbolic links"""
     17     try:
---> 18         os.stat(path)
     19     except os.error:
     20         return False

TypeError: coercing to Unicode: need string or buffer, NoneType found
```

After that when I try to import astropy I get:

```
import astropy
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-13-d192094ef7da> in <module>()
----> 1 import astropy

/usr/local/lib/python2.7/dist-packages/astropy/__init__.py in <module>()
    244     log = _init_log()
    245 
--> 246     _initialize_astropy()
    247 
    248     from .utils.misc import find_api_page

/usr/local/lib/python2.7/dist-packages/astropy/__init__.py in _initialize_astropy()
    177 # configuration file with the defaults
    178 def _initialize_astropy():
--> 179     from . import config
    180 
    181     import os

ImportError: cannot import name config
```