weixin_39942191 2020-11-20 20:32
浏览 0

Fail to imoprt cPickle by other module(Theano)

Originally reported by: Yiqun Liu (Bitbucket: yiqun_liu, GitHub: Unknown)

Yesterday, I updated all the packages via pip and theano couldn't be imported due to following error:


#!Terminal

>>> 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
</module></module></module></module></module></module></module></module></stdin>

It seems that the problem comes from six - Yet I've tried importing cPickle itself in python and it didn't fail. Moreover, the issue still existed even after I updated Theano to the bleeding edge version. And my terminal returned these words when I typed 'pip show six':


#!Terminal

---
Metadata-Version: 2.0
Name: six
Version: 1.9.0
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin.org
License: MIT
Location: /Library/Python/2.7/site-packages
Requires: 

Evidently, I've six installed on my computer. Therefore, I can make sure that the problem is due to a bug of six. Please fix the issue, thanks.

  • Bitbucket: https://bitbucket.org/gutworth/six/issue/132

该提问来源于开源项目:benjaminp/six

  • 写回答

6条回答 默认 最新

  • weixin_39942191 2020-11-20 20:32
    关注

    Original comment by Andrew Arrasmith (Bitbucket: aarrasmi, GitHub: aarrasmi):

    Hi Matthias,

    I tried it with both the latest release of Theano and the "bleeding edge" version on the git repo. By up to date I mean the version that I get with pip with the upgrade flag. My copy of Theano (I reverted to the latest release) has version 1.9.0 of six installed with it, and and my machine has six 1.10.0 installed.

    I think that in just now confirming I had the latest versions (which I did last night as well) I may have found the problem. It seems that for some reason my pip upgrade calls last night didn't remove a copy of 1.5.2 (and I must have missed it in the output of the find command you recommend above) while just now redoing

    
    #!BASH
    sudo pip install -U six
    
    
    

    found and removed the old version.

    I must have been doing something stupid last night and somehow missing this.

    Sorry to bother you over what was probably just an old version that was hiding from me, and thank you for your response.

    Andrew

    评论

报告相同问题?