44

I'm trying to build scipy and I get a RuntimeError:

$sudo python setup.py build
Processing scipy/cluster/_vq_rewrite.pyx
Traceback (most recent call last):
  File "tools/cythonize.py", line 172, in <module>
    main()
  File "tools/cythonize.py", line 168, in main
    find_process_files(root_dir)
  File "tools/cythonize.py", line 160, in find_process_files
    process(cur_dir, fromfile, tofile, function, hash_db)
  File "tools/cythonize.py", line 137, in process
    processor_function(fromfile, tofile)
  File "tools/cythonize.py", line 66, in process_pyx
    raise OSError('Cython needs to be installed')
OSError: Cython needs to be installed

Traceback (most recent call last):
  File "setup.py", line 209, in <module>
    setup_package()
  File "setup.py", line 202, in setup_package
    generate_cython()
  File "setup.py", line 147, in generate_cython
    raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!

What are the ways to provide cython to remedy this error?

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Liatz
  • 4,997
  • 7
  • 28
  • 33

4 Answers4

87

Python setuptools solved the problem.

http://docs.cython.org/src/quickstart/install.html
easy_install cython or pip install cython

Roman
  • 8,826
  • 10
  • 63
  • 103
Liatz
  • 4,997
  • 7
  • 28
  • 33
3

If you do not have Cython installed then use: pip install Cython. However, if you do have an old version of Cython installed like me then this is what solved it for me: pip install --upgrade Cython

SuperKogito
  • 2,998
  • 3
  • 16
  • 37
0

For me, this problem occurred due to incompatible python + pandas versions due to incorrect environment configurations despite using Anaconda. Installing Cython via pip worked too, but that wasn't the real solution.

Akash Agarwal
  • 2,326
  • 1
  • 27
  • 57
0

I installed Cython which did not solve the problem. I solved it by upgrading my pip: pip3 install --upgrade pip.

tschomacker
  • 631
  • 10
  • 18