2017-04-09 205 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