2017-05-07 65 views
31

我試着去使用Keras(順序),但我得到以下錯誤,當我試圖將其導入:AttributeError的:「模塊」對象有沒有屬性「計算」

File "kaggle_titanic_keras.py", line 3, in <module> 
    from keras.models import Sequential 
    File "/anaconda/lib/python2.7/site-packages/keras/__init__.py", line 4, in <module> 
    from . import applications 
    File "/anaconda/lib/python2.7/site-packages/keras/applications/__init__.py", line 1, in <module> 
    from .vgg16 import VGG16 
    File "/anaconda/lib/python2.7/site-packages/keras/applications/vgg16.py", line 14, in <module> 
    from ..models import Model 
    File "/anaconda/lib/python2.7/site-packages/keras/models.py", line 14, in <module> 
    from . import layers as layer_module 
    File "/anaconda/lib/python2.7/site-packages/keras/layers/__init__.py", line 4, in <module> 
    from ..engine import Layer 
    File "/anaconda/lib/python2.7/site-packages/keras/engine/__init__.py", line 8, in <module> 
    from .training import Model 
    File "/anaconda/lib/python2.7/site-packages/keras/engine/training.py", line 24, in <module> 
    from .. import callbacks as cbks 
    File "/anaconda/lib/python2.7/site-packages/keras/callbacks.py", line 25, in <module> 
    from tensorflow.contrib.tensorboard.plugins import projector 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/__init__.py", line 30, in <module> 
    from tensorflow.contrib import factorization 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/factorization/__init__.py", line 24, in <module> 
    from tensorflow.contrib.factorization.python.ops.gmm import * 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/factorization/python/ops/gmm.py", line 27, in <module> 
    from tensorflow.contrib.learn.python.learn.estimators import estimator 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/__init__.py", line 87, in <module> 
    from tensorflow.contrib.learn.python.learn import * 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/__init__.py", line 23, in <module> 
    from tensorflow.contrib.learn.python.learn import * 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 25, in <module> 
    from tensorflow.contrib.learn.python.learn import estimators 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/__init__.py", line 297, in <module> 
    from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNClassifier 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn.py", line 29, in <module> 
    from tensorflow.contrib.learn.python.learn.estimators import dnn_linear_combined 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 31, in <module> 
    from tensorflow.contrib.learn.python.learn.estimators import estimator 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 49, in <module> 
    from tensorflow.contrib.learn.python.learn.learn_io import data_feeder 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/__init__.py", line 21, in <module> 
    from tensorflow.contrib.learn.python.learn.learn_io.dask_io import extract_dask_data 
    File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py", line 26, in <module> 
    import dask.dataframe as dd 
    File "/anaconda/lib/python2.7/site-packages/dask/dataframe/__init__.py", line 3, in <module> 
    from .core import (DataFrame, Series, Index, _Frame, map_partitions, 
    File "/anaconda/lib/python2.7/site-packages/dask/dataframe/core.py", line 38, in <module> 
    pd.computation.expressions.set_use_numexpr(False) 
AttributeError: 'module' object has no attribute 'computation' 

進出口運行的Python 2.7,TensorFlow 1.1 ,凱拉斯2.0.3和'升級'爲熊貓0.20.1昨天我懷疑是造成這個問題,但錯誤信息沒有提到它。

+0

你是如何更新'pandas'的?你確定你的python from anaconda可以訪問嗎? – Dadep

+0

我確實使用了conda和pip。我剛剛使用.__版本___來檢查它正在訪問的熊貓版本,它回來了0.20.1 – Greg

+4

這是由於熊貓的新版本(0.20.1)。星期五推出了一個新版本的dask,以修復新熊貓版本中出現的問題。將dask更新爲0.14.3應該可以解決您的錯誤。 –

回答

80

更新DASK到0.15.0可以解決這個問題

更新CMD:conda update dask

輸入pip show dask將顯示如下消息

Name: dask 
Version: 0.15.0 
Summary: Parallel PyData with Task Scheduling 
Home-page: http://github.com/dask/dask/ 
Author: Matthew Rocklin 
Author-email: [email protected] 
License: BSD 
Location: c:\anaconda3\lib\site-packages 
Requires: 
+3

更新dask爲我工作。但我更新它通過點而不是conda: pip install --upgrade dask – n3utrino

+0

根據[pandas issue 18355](https://github.com/pandas-dev/pandas/)需要將dask更新爲> 0.15.3問題/ 18355#issuecomment-345453318) – shadi

10

我恢復到Pandas 0.19.2並解決了這個問題。

+3

我認爲更好的答案是更新dask,如下所示:https://stackoverflow.com/a/44615129/1863542 – vsachar

17

DASK-0.14.3作品,並消除了導入錯誤

7

完整的命令我用的是

conda install pandas=0.19.2 

,並回答y降級大熊貓和它現在的工作。

2

我已經安裝了以下版本:

  • python 3.5
  • tensorflow 1.2.1
  • 熊貓0.21
  • DASK 0.15.3

,並得到以下錯誤:

pd.core.computation.expressions.set_use_numexpr(False) 
AttributeError: 'module' object has no attribute 'expressions' 

我降級爲大熊貓0.19.2dask 0.15.0和python腳本工作正常!

相關問題