Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown file type error with .pyx file

Tags:

python

I'm trying to build a Python package (pyregion) that contains a *.pyx file and error comes during the build process. Checking out the below output:

$ python setup.py build
running build
running build_py
creating build
creating build/lib.macosx-10.5-x86_64-2.7
....
running build_ext
building 'pyregion._region_filter' extension
C compiler: gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -DNDEBUG -g -O3 -arch x86_64

error: unknown file type '.pyx' (from 'src/_region_filter.pyx')

Any ideas on what the issue could be? Just to note, I'm using the Enthought build of Python (7.1) on OSX with the latest Xcode (4.1).

Cheers

like image 926
ebressert Avatar asked Jul 27 '11 14:07

ebressert


4 Answers

The .pyx should should be compiled to C with Pyrex and then compiled to object code. Check if a src/_region_filter.c file is present in the distribution and hack the setup.py script to build that instead. (Also, consider filing a bug report, since this shouldn't be happening.)

like image 144
Fred Foo Avatar answered Nov 11 '22 00:11

Fred Foo


Install pyrex first and it will work.

Do the following: sudo pip install pyrex

like image 29
chachi Avatar answered Nov 11 '22 00:11

chachi


python3.6 -m pip install Cython

Installing Cython solves the problem for me!

like image 4
Nikola Nikolovski Avatar answered Nov 11 '22 01:11

Nikola Nikolovski


The only solution to this problem for me, when attempting to install pyFFTW, was to first install Cython via pip. Also see https://github.com/pyFFTW/pyFFTW/issues/252 .

like image 1
Reinderien Avatar answered Nov 11 '22 00:11

Reinderien