

[書籍「はじめての深層学習プログラミング」](https://www.amazon.co.jp/%E3%81%AF%E3%81%98%E3%82%81%E3%81%A6%E3%81%AE%E6%B7%B1%E5%B1%A4%E5%AD%A6%E7%BF%92-%E3%83%87%E3%82%A3%E3%83%BC%E3%83%97%E3%83%A9%E3%83%BC%E3%83%8B%E3%83%B3%E3%82%B0-%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0-%E6%B8%85%E6%B0%B4-%E4%BA%AE/dp/4774185345)の環境構築を終えて、いざ[サンプルコード](https://github.com/uei/deel/blob/master/examples/test.py)を実行してみたのですが、以下のようなエラーが出ます。

[code]

    Traceback (most recent call last):
      File "test.py", line 2, in <module>
        from deel.network import *
      File "build/bdist.linux-i686/egg/deel/network/__init__.py", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/chainer/__init__.py", line 3, in <module>
        import pkg_resources
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2760, in <module>
        add_activation_listener(lambda dist: dist.activate())
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 738, in subscribe
        callback(dist)
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2760, in <lambda>
        add_activation_listener(lambda dist: dist.activate())
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2314, in activate
        for pkg in self._get_metadata('namespace_packages.txt'):
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2305, in _get_metadata
        for line in self.get_metadata_lines(name):
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1369, in get_metadata_lines
        return yield_lines(self.get_metadata(name))
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1361, in get_metadata
        return self._get(self._fn(self.egg_info,name))
      File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1470, in _get
        stream = open(path, 'rb')
    IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/protobuf-3.1.0.post1-py2.7.egg/EGG-INFO/namespace_packages.txt'
    ~ 
    
[/code]

4行目の

[code]

       File "build/bdist.linux-i686/egg/deel/network/__init__.py", line 1, in <module>
    
[/code]

についてですが、

[code]

        find / -name "bdist.linux-i686"
    
[/code]

して実際のディレクトリを探したところbdist.linux-i686ディレクトリはあったのですが（場所：deel/build/bdist.linux-i686）中身が空でした。

また最後にPermission denied:とあるのでsudoをつけて実行すると

[code]

    Traceback (most recent call last):
    
    
    File "test.py", line 2, in <module>
        from deel.network import *
      File "build/bdist.linux-i686/egg/deel/network/__init__.py", line 1, in <module>
      File "/usr/local/lib/python2.7/dist-packages/chainer/__init__.py", line 25, in <module>
        from chainer import serializers  # NOQA
      File "/usr/local/lib/python2.7/dist-packages/chainer/serializers/__init__.py", line 1, in <module>
        from chainer.serializers import hdf5
      File "/usr/local/lib/python2.7/dist-packages/chainer/serializers/hdf5.py", line 8, in <module>
        import h5py
      File "/usr/local/lib/python2.7/dist-packages/h5py-2.6.0-py2.7-linux-i686.egg/h5py/__init__.py", line 34, in <module>
        from ._conv import register_converters as _register_converters
      File "h5py/h5t.pxd", line 14, in init h5py._conv (/tmp/easy_install-lp3ofH/h5py-2.6.0/h5py/_conv.c:7527)
      File "h5py/numpy.pxd", line 66, in init h5py.h5t (/tmp/easy_install-lp3ofH/h5py-2.6.0/h5py/h5t.c:20799)
    ValueError: numpy.dtype has the wrong size, try recompiling. Expected 52, got 56
    
[/code]

というエラーがでます。

numpy関係のエラーだと思いますが、easy_installでnumpyを再インストールしてもダメでした。

何か解決のヒントなどいただけたら幸いです。

環境: Ubuntu 14.04, Python 2.7


CC BY-SA 3.0
2016-12-10T15:27:43.823
31074
2016-12-10T16:34:14.030
2016-12-10T16:34:14.030
3974
19876
question
python numpy chainer
書籍「はじめての深層学習プログラミング」のサンプルコードが実行できない