A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ipython/ipython/issues/1401/ below:

numpy arrays cannot be used with View.apply() in Python 3 · Issue #1401 · ipython/ipython · GitHub

In Python 3, numpy arrays cannot be passed to apply(), due to explicit use of buffer instead of memoryview.

Tested on:
Python 3.2.1 (default, Jul 18 2011, 16:24:40) [GCC]
IPython 0.13.dev, 0.12

from IPython.parallel import Client
import numpy

def test(arr):
    return arr[0]

if __name__ == '__main__':
    dview = Client(profile = 'local')
    arr = numpy.arange(10)

    res = dview[0].apply(test, arr)
    print(res.get())

The following error occurs:

Traceback (most recent call last):
  File "/home/aver/git/sdp/test(emd).py", line 21, in <module>
    res = call_emd(lst, parallel_profile = 'local')
  File "/home/aver/git/sdp/sdp/decorator/parallel.py", line 16, in wrapper
    async_result.append(engines_view.apply_sync(func, i, **kwargs))
  File "<string>", line 2, in apply_sync
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/client/view.py", line 70, in spin_after
    ret = f(self, *args, **kwargs)
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/client/view.py", line 227, in apply_sync
    return self._really_apply(f, args, kwargs, block=True)
  File "<string>", line 2, in _really_apply
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/client/view.py", line 59, in sync_results
    ret = f(self, *args, **kwargs)
  File "<string>", line 2, in _really_apply
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/client/view.py", line 48, in save_ids
    ret = f(self, *args, **kwargs)
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/client/view.py", line 997, in _really_apply
    return ar.get()
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/client/asyncresult.py", line 104, in get
    raise self._exception
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/client/asyncresult.py", line 129, in wait
    raise r
IPython.parallel.error.RemoteError: NameError(global name 'buffer' is not defined)
Traceback (most recent call last):
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/engine/streamkernel.py", line 320, in apply_request
    f,args,kwargs = unpack_apply_message(bufs, working, copy=False)
  File "/usr/local/lib/python3.2/site-packages/ipython-0.13.dev-py3.2.egg/IPython/parallel/util.py", line 305, in unpack_apply_message
    sa.data = buffer(m)
NameError: global name 'buffer' is not defined

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4