2017-04-09 204 views
2

我已经安装了Theano这样:Theano导入错误:无法导入名称inplace_increment

(python2) bash-3.2$ sudo pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git 

我使用畅达与Python 2.7。圆括号中的python2是我的conda环境。我试图从iGAN运行代码:https://github.com/junyanz/iGAN。我在OS X 10.11.6上。

我得到的错误是ImportError: cannot import name inplace_increment。我尝试手动删除Theano缓存(如https://github.com/Theano/Theano/issues/5564中所述),同样的错误仍然存​​在。 (我不能使用theano-cache purge,因为它需要安装与OpenCV所需版本冲突的scipy版本。)我也尝试通过pip卸载并重新安装Theano,仍然得到相同的错误。有什么建议么?

这里的背景:

(python2) bash-3.2$ python iGAN_main.py 
//anaconda/envs/python2/lib/python2.7/site-packages/numpy/lib/utils.py:254: FutureWarning: Numpy has detected that you (may be) writing to an array returned 
by numpy.diagonal or by selecting multiple fields in a record 
array. This code will likely break in the next numpy release -- 
see numpy.diagonal or arrays.indexing reference docs for details. 
The quick fix is to make an explicit copy (e.g., do 
arr.diagonal().copy() or arr[['f0','f1']].copy()). 
    ai = a.__array_interface__ 
Traceback (most recent call last): 
    File "iGAN_main.py", line 9, in <module> 
    import constrained_opt 
    File "/Users/katherineye/Desktop/Code/iGAN/constrained_opt.py", line 3, in <module> 
    from lib.rng import np_rng 
    File "/Users/katherineye/Desktop/Code/iGAN/lib/rng.py", line 2, in <module> 
    from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams 
    File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/__init__.py", line 102, in <module> 
    from theano.scan_module import (scan, map, reduce, foldl, foldr, clone, 
    File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/scan_module/__init__.py", line 41, in <module> 
    from theano.scan_module import scan_opt 
    File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/scan_module/scan_opt.py", line 60, in <module> 
    from theano import tensor, scalar 
    File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/tensor/__init__.py", line 9, in <module> 
    from theano.tensor.subtensor import * 
    File "//anaconda/envs/python2/lib/python2.7/site-packages/theano/tensor/subtensor.py", line 27, in <module> 
    from cutils_ext.cutils_ext import inplace_increment 
ImportError: cannot import name inplace_increment 

回答

1

我有同样的问题。

删除缓存手动工作。

rm -rf ~/.theano 

如果这样做不能帮助尝试从源代码安装。

python setup.py install