我的keras与theano和GPU配合得很好,但今天早上,我用以下方式升级了keras和theano之后:
pip install git+git://github.com/fchollet/keras.git --upgrade --no-deps
pip install git+git://github.com/Theano/Theano.git --upgrade --no-deps
并运行import theano
,它首先引发错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 79, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan_opt.py", line 71, in <module>
from theano.scan_module import scan_op
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan_op.py", line 58, in <module>
from six import iteritems, integer_types, raise_from
ImportError: cannot import name raise_from
然后再次运行import theano
,它会引发错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 79, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan_opt.py", line 60, in <module>
from theano import tensor, scalar
ImportError: cannot import name tensor
运行import keras
,它首先引发错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/keras/__init__.py", line 2, in <module>
from . import backend
File "/usr/local/lib/python2.7/dist-packages/keras/backend/__init__.py", line 66, in <module>
from .theano_backend import *
File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 1, in <module>
import theano
File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 79, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan_opt.py", line 71, in <module>
from theano.scan_module import scan_op
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan_op.py", line 58, in <module>
from six import iteritems, integer_types, raise_from
ImportError: cannot import name raise_from
然后再次运行import keras
,它会引发错误:
Using Theano backend.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/keras/__init__.py", line 2, in <module>
from . import backend
File "/usr/local/lib/python2.7/dist-packages/keras/backend/__init__.py", line 66, in <module>
from .theano_backend import *
File "/usr/local/lib/python2.7/dist-packages/keras/backend/theano_backend.py", line 1, in <module>
import theano
File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 79, in <module>
from theano.scan_module import (scan, map, reduce, foldl, foldr, clone,
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/__init__.py", line 41, in <module>
from theano.scan_module import scan_opt
File "/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan_opt.py", line 60, in <module>
from theano import tensor, scalar
ImportError: cannot import name tensor
我真的很困惑这个问题,以前有人遇到过这个问题吗?提前谢谢!
答案 0 :(得分:1)
来自pip
- no-deps, - no-dependencies 忽略包依赖
删除该标志,一切正常