Why does Cython break Python?
I just started using Cython and am trying to implement a simple Fibonacci function as described here:
http://docs.cython.org/src/tutorial/cython_tutorial.html
The problem is, when I try to run a function for a given input, in Spyder, the kernel dies and python crashes.
Specifically, if I open Spyder and run
%%file cython_fib.pyx
def fib(n):
a, b = 0, 1
while b < n:
print b,
a, b = b, a + b
then the cython_fib.pyx file is generated. Then I can run
import pyximport; pyximport.install()
import cython_fib
to import the Cython function cython_fib. At this point in the process, Spyder uses about 80% of its memory. When I try to call a function,
cython_fib.fib(2000)
IPython console in Spyder throws an error
It seems the kernel died unexpectedly. Use 'Restart kernel' to continue using this console.
repeatedly.
What is causing this crash? Obviously using Cython uses a lot of memory, but that shouldn't be a problem for such a simple example.
I am using Anaconda 2.0.1 with Python 3.4 on Windows 7.
source to share
No one has answered this question yet
Check out similar questions: