Error in running keras for deep learning in ubuntu 14.04

465 views Asked by At

I had implemented a neural net architecture in keras using tensor flow as a backend.

Which is working fine in last month but when I tried to run the code again it gives a series of errors. I tried to uninstall my packages installed and reinstall it but it never worked for me. I also tried the same combination with theano as a backend but it still gives me error.

I am attaching the traceback of the hope I could get a better solution for my question.

Using TensorFlow backend.
Traceback (most recent call last):
  File "DeepNeuralNetwork.py", line 9, in <module>
    from keras.models import Sequential
  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 69, in <module>
    from .tensorflow_backend import *
  File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1, in <module>
    import tensorflow as tf
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 65, in <module>
    import tensorflow.contrib as contrib
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/__init__.py", line 28, in <module>
    from tensorflow.contrib import learn
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/__init__.py", line 72, in <module>
    from tensorflow.contrib.learn.python.learn import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/__init__.py", line 23, in <module>
    from tensorflow.contrib.learn.python.learn import *
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 25, in <module>
    from tensorflow.contrib.learn.python.learn import estimators
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/__init__.py", line 23, in <module>
    from tensorflow.contrib.learn.python.learn.estimators.autoencoder import TensorFlowDNNAutoencoder
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/autoencoder.py", line 25, in <module>
    from tensorflow.contrib.learn.python.learn.estimators.base import TensorFlowBaseTransformer
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/base.py", line 34, in <module>
    from tensorflow.contrib.learn.python.learn.estimators import estimator
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 38, in <module>
    from tensorflow.contrib.learn.python.learn.io import data_feeder
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/io/__init__.py", line 22, in <module>
    from tensorflow.contrib.learn.python.learn.io.dask_io import extract_dask_data
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/io/dask_io.py", line 26, in <module>
    import dask.dataframe as dd
  File "/usr/local/lib/python2.7/dist-packages/dask/dataframe/__init__.py", line 5, in <module>
    from .io import (from_array, from_pandas, from_bcolz,
  File "/usr/local/lib/python2.7/dist-packages/dask/dataframe/io/__init__.py", line 6, in <module>
    from .csv import read_csv, to_csv, read_table
  File "/usr/local/lib/python2.7/dist-packages/dask/dataframe/io/csv.py", line 147, in <module>
    CPU_COUNT = psutil.cpu_count()
AttributeError: 'module' object has no attribute 'cpu_count'
1

There are 1 answers

0
glS On BEST ANSWER

As you can see from the last lines of the backtrace:

 File "/usr/local/lib/python2.7/dist-packages/dask/dataframe/io/csv.py", line 147, in <module>
    CPU_COUNT = psutil.cpu_count()
AttributeError: 'module' object has no attribute 'cpu_count'

the error is due to dask trying to call the attribute cpu_count of the module psutil. This is probably due to some wrong version of psutil installed, and should be solved by simply upgrading or reinstalling it.