You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OS X, 10.7. I've been going through the first several cython examples in the cython tutorial, and all of the tutorial examples work correctly for me thus far.
However, when I try to do what Fernando did in his Science And Python presentation at Pycon Canada (at playback position 37:42), I get a strange error. The code is:
%load_ext cythonmagic
%%cython
cdef double fcy(double x) except? -2:
return x**2-x
def integrate_fcy(double a, double b, int N):
cdef int i
cdef double s, dx
s = 0; dx = (b-a)/N
for i in range(N):
s += fcy(a+i*dx)
return s * dx
The notebook output:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
in ()
----> 1 get_ipython()._run_cached_cell_magic('cython', '')
/usr/local/lib/python3.2/site-packages/IPython/core/interactiveshell.py in _run_cached_cell_magic(self, magic_name, line)
2513 cell = self._current_cell_magic_body
2514 self._current_cell_magic_body = None
-> 2515 return self.run_cell_magic(magic_name, line, cell)
2516
2517 def run_cell(self, raw_cell, store_history=False, silent=False):
/usr/local/lib/python3.2/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2092 magic_arg_s = self.var_expand(line, stack_depth)
2093 with self.builtin_trap:
-> 2094 result = fn(line, cell)
2095 return result
2096
/usr/local/lib/python3.2/site-packages/IPython/extensions/cythonmagic.py in cython(self, line, cell)
/usr/local/lib/python3.2/site-packages/IPython/core/magic.py in (f, *a, **k)
190 # but it's overkill for just that one bit of state.
191 def magic_deco(arg):
--> 192 call = lambda f, *a, **k: f(*a, **k)
193
194 if isinstance(arg, collections.Callable):
/usr/local/lib/python3.2/site-packages/IPython/extensions/cythonmagic.py in cython(self, line, cell)
187 self._code_cache[key] = module_name
188
--> 189 module = imp.load_dynamic(module_name, module_path)
190 self._import_all(module)
191
ImportError: dlopen(/Users/lab/.ipython/cython/_cython_magic_0e71fc3338606be06aed17a605e60bbd.cpython-32m.so, 2): image not found
This is the output in the Terminal that I used to start the IPython notebook session:
OS X, 10.7. I've been going through the first several cython examples in the cython tutorial, and all of the tutorial examples work correctly for me thus far.
However, when I try to do what Fernando did in his Science And Python presentation at Pycon Canada (at playback position 37:42), I get a strange error. The code is:
The notebook output:
This is the output in the Terminal that I used to start the IPython notebook session:
This worked ok for me, but not the %%cython magic above:
The text was updated successfully, but these errors were encountered: