web-dev-qa-db-ja.com

AttributeError:「モジュール」オブジェクトには属性「計算」がありません

Keras(Sequential)を使用しようとしていますが、インポートしようとすると次のエラーが表示されます。

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、Keras 2.0.3を実行し、昨日Pandas 0.20.1に「アップグレード」しましたが、問題が発生していると思われますが、エラーメッセージには何も表示されません。

36
Greg

ダスクを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:
88
SamudraYe

dask-0.14.3は動作し、インポートエラーを排除します

17
user2897775

Pandas 0.19.2に戻し、この問題を解決しました。

10
Greg

私が使用する完全なコマンドは

conda install pandas=0.19.2

yと答えてpandasをダウングレードすると、現在は機能しています。

8
user3599207

以下のバージョンをインストールしました:

  • python 3.5
  • テンソルフロー1.2.1
  • パンダ0.21
  • 夕暮れ0.15.3

次のエラーが発生していました:

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

pandas 0.19.2およびdask 0.15.0にダウングレードしましたおよびpythonスクリプトは正常に機能しました!

3
Cagg