2. theano install and import issue

2.1. Situation:

  • I wanted to install theano and followed some tutorials on the Internet

  • Firstly, I used pip install theano on my Mac and due to some issue about Apple protecting its operating system, even though I used sudo pip install theano, I still don’t have the permission to install it.

  • Secondly, when using theano in some cases, you may occur some situation like this:

    >>> import theano
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/Library/Python/2.7/site-packages/theano/__init__.py", line 52, in <module>
    from theano.gof import (
     File "/Library/Python/2.7/site-packages/theano/gof/__init__.py", line 38, in <module>
    from theano.gof.cc import \
    File "/Library/Python/2.7/site-packages/theano/gof/cc.py", line 30, in <module>
    from theano.gof import link
    File "/Library/Python/2.7/site-packages/theano/gof/link.py", line 18, in <module>
    from theano.gof.type import Type
    File "/Library/Python/2.7/site-packages/theano/gof/type.py", line 17, in <module>
    from theano.gof.op import CLinkerObject
    File "/Library/Python/2.7/site-packages/theano/gof/op.py", line 25, in <module>
    from theano.gof.cmodule import GCC_compiler
    File "/Library/Python/2.7/site-packages/theano/gof/cmodule.py", line 8, in <module>
    import six.moves.cPickle as pickle
    ImportError: No module named cPickle
    

and you are pretty sure about you have installed the module cPickle.

2.2. Solution:

  • To the first question, this may help:

    sudo -H pip install --ignore-installed six
    sudo pip install theano
    
  • To the second question, this may help:

    sudo easy_install --upgrade six