Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import error: TypeError: <method 'max' of 'numpy.ndarray' objects> is not a Python function #2154

Closed
weiliu620 opened this issue Apr 28, 2016 · 1 comment

Comments

@weiliu620
Copy link

weiliu620 commented Apr 28, 2016

Having a import error on Ubuntu 14.04 LTS 64 bit with python 2.7, and trying to import tensorflow 0.8.0

In [1]: import tensorflow
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally

TypeError Traceback (most recent call last)
in ()
----> 1 import tensorflow

/home/weiliu/.local/lib/python2.7/site-packages/tensorflow/init.py in ()
21 from future import print_function
22
---> 23 from tensorflow.python import *

/home/weiliu/.local/lib/python2.7/site-packages/tensorflow/python/init.py in ()
60 from tensorflow.core.util.event_pb2 import *
61 # Import things out of contrib
---> 62 import tensorflow.contrib as contrib
63
64 # Framework

/home/weiliu/.local/lib/python2.7/site-packages/tensorflow/contrib/init.py in ()
24 from tensorflow.contrib import framework
25 from tensorflow.contrib import layers
---> 26 from tensorflow.contrib import learn
27 from tensorflow.contrib import linear_optimizer
28 from tensorflow.contrib import lookup

/home/weiliu/.local/lib/python2.7/site-packages/tensorflow/contrib/learn/init.py in ()
18 from future import print_function
19
---> 20 from tensorflow.contrib.learn.python.learn import *

/home/weiliu/.local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/init.py in ()
18 from future import print_function
19
---> 20 from tensorflow.contrib.learn.python.learn import *

/home/weiliu/.local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/init.py in ()
20 import numpy as np
21
---> 22 from tensorflow.contrib.learn.python.learn.io import *
23 from tensorflow.contrib.learn.python.learn.estimators import *
24 from tensorflow.contrib.learn.python.learn import ops

/home/weiliu/.local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/io/init.py in ()
18
19 from tensorflow.contrib.learn.python.learn.io.pandas_io import *
---> 20 from tensorflow.contrib.learn.python.learn.io.dask_io import *

/home/weiliu/.local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/io/dask_io.py in ()
21
22 try:
---> 23 import dask.dataframe as dd
24 allowed_classes = (dd.Series, dd.DataFrame)
25 HAS_DASK = True

/home/weiliu/.local/lib/python2.7/site-packages/dask/dataframe/init.py in ()
----> 1 from .core import (DataFrame, Series, Index, _Frame, map_partitions,
2 repartition)
3 from .io import (read_csv, from_array, from_bcolz, from_array, from_bcolz,
4 from_pandas, from_dask_array, from_castra, read_hdf,
5 from_imperative)

/home/weiliu/.local/lib/python2.7/site-packages/dask/dataframe/core.py in ()
1232
1233
-> 1234 class Index(Series):
1235
1236 _partition_type = pd.Index

/home/weiliu/.local/lib/python2.7/site-packages/dask/dataframe/core.py in Index()
1264 return self.drop_duplicates().count()
1265
-> 1266 @derived_from(pd.Index)
1267 def max(self):
1268 # it doesn't support axis and skipna kwds

/home/weiliu/.local/lib/python2.7/site-packages/dask/utils.pyc in wrapper(method)
524
525 method_args = getargspec(method).args
--> 526 original_args = getargspec(original_method).args
527
528 not_supported = [m for m in original_args if m not in method_args]

/home/weiliu/.local/lib/python2.7/site-packages/dask/compatibility.pyc in getargspec(func)
188 return _getargspec(func.init)
189 else:
--> 190 return _getargspec(func)
191
192 def skip(func):

/home/weiliu/.local/lib/python2.7/site-packages/dask/compatibility.pyc in _getargspec(func)
54
55 def _getargspec(func):
---> 56 return inspect.getargspec(func)
57
58 if sys.version_info[1] <= 7:

/usr/lib/python2.7/inspect.pyc in getargspec(func)
814 func = func.im_func
815 if not isfunction(func):
--> 816 raise TypeError('{!r} is not a Python function'.format(func))
817 args, varargs, varkw = getargs(func.func_code)
818 return ArgSpec(args, varargs, varkw, func.func_defaults)

TypeError: <method 'max' of 'numpy.ndarray' objects> is not a Python function

========== end of import error =========================

It looks like a upstream (dask package) error, because I can reproduce it by running:

In [2]: import dask.dataframe


TypeError Traceback (most recent call last)
in ()
----> 1 import dask.dataframe

/home/weiliu/.local/lib/python2.7/site-packages/dask/dataframe/init.py in ()
----> 1 from .core import (DataFrame, Series, Index, _Frame, map_partitions,
2 repartition)
3 from .io import (read_csv, from_array, from_bcolz, from_array, from_bcolz,
4 from_pandas, from_dask_array, from_castra, read_hdf,
5 from_imperative)

/home/weiliu/.local/lib/python2.7/site-packages/dask/dataframe/core.py in ()
1232
1233
-> 1234 class Index(Series):
1235
1236 _partition_type = pd.Index

/home/weiliu/.local/lib/python2.7/site-packages/dask/dataframe/core.py in Index()
1264 return self.drop_duplicates().count()
1265
-> 1266 @derived_from(pd.Index)
1267 def max(self):
1268 # it doesn't support axis and skipna kwds

/home/weiliu/.local/lib/python2.7/site-packages/dask/utils.pyc in wrapper(method)
524
525 method_args = getargspec(method).args
--> 526 original_args = getargspec(original_method).args
527
528 not_supported = [m for m in original_args if m not in method_args]

/home/weiliu/.local/lib/python2.7/site-packages/dask/compatibility.pyc in getargspec(func)
188 return _getargspec(func.init)
189 else:
--> 190 return _getargspec(func)
191
192 def skip(func):

/home/weiliu/.local/lib/python2.7/site-packages/dask/compatibility.pyc in _getargspec(func)
54
55 def _getargspec(func):
---> 56 return inspect.getargspec(func)
57
58 if sys.version_info[1] <= 7:

/usr/lib/python2.7/inspect.pyc in getargspec(func)
814 func = func.im_func
815 if not isfunction(func):
--> 816 raise TypeError('{!r} is not a Python function'.format(func))
817 args, varargs, varkw = getargs(func.func_code)
818 return ArgSpec(args, varargs, varkw, func.func_defaults)

TypeError: <method 'max' of 'numpy.ndarray' objects> is not a Python function
======== end of import dask ==========
The dask verison is 0.8.2 from 'pip freeze'.

I can provide more information if needed.

@weiliu620
Copy link
Author

After upgrading pandas, I fixed the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants