Skip to content

Instantly share code, notes, and snippets.

@Dschoni
Forked from phillipberndt/setup.py
Last active August 29, 2015 14:05
Show Gist options
  • Save Dschoni/4bebd2e6f283adf2563e to your computer and use it in GitHub Desktop.
Save Dschoni/4bebd2e6f283adf2563e to your computer and use it in GitHub Desktop.
running build_ext
cythoning source/Uncompiled.pyx to source/Uncompiled.c
Error compiling Cython file:
------------------------------------------------------------
...
import cython
^
------------------------------------------------------------
source/Uncompiled.pyx:1:7: Compiler crash in AnalyseDeclarationsTransform
File 'ModuleNode.py', line 101, in analyse_declarations: ModuleNode(Uncompiled.pyx:1:0,
full_module_name = 'Test.Compiled')
File 'Nodes.py', line 383, in analyse_declarations: StatListNode(Uncompiled.pyx:1:0)
File 'Nodes.py', line 383, in analyse_declarations: StatListNode(Uncompiled.pyx:1:7)
File 'Nodes.py', line 6785, in analyse_declarations: CImportStatNode(Uncompiled.pyx:1:7,
as_name = u'cython',
module_name = u'cython')
Compiler crash traceback from this point on:
File "/usr/lib/python2.7/dist-packages/Cython/Compiler/Nodes.py", line 6785, in analyse_declarations
module_scope = env.find_module(self.module_name, self.pos)
File "/usr/lib/python2.7/dist-packages/Cython/Compiler/Symtab.py", line 1089, in find_module
module_name, relative_to = self.parent_module, pos = pos)
File "/usr/lib/python2.7/dist-packages/Cython/Compiler/Main.py", line 132, in find_module
pxd_pathname = self.find_pxd_file(qualified_name, pos)
File "/usr/lib/python2.7/dist-packages/Cython/Compiler/Main.py", line 184, in find_pxd_file
pxd = self.search_include_directories(qualified_name, ".pxd", pos, sys_path=True)
File "/usr/lib/python2.7/dist-packages/Cython/Compiler/Main.py", line 225, in search_include_directories
tuple(self.include_directories), qualified_name, suffix, pos, include, sys_path)
File "/usr/lib/python2.7/dist-packages/Cython/Utils.py", line 16, in wrapper
res = cache[args] = f(*args)
File "/usr/lib/python2.7/dist-packages/Cython/Utils.py", line 101, in search_include_directories
path = os.path.join(dir, dotted_filename)
File "/usr/lib/python2.7/posixpath.py", line 80, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)
building 'Test.Compiled' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/source
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c source/Uncompiled.c -o build/temp.linux-x86_64-2.7/source/Uncompiled.o
source/Uncompiled.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
#!/usr/bin/env python
from distutils.core import setup, Extension
from Cython.Distutils import build_ext
import numpy as np
linext=[Extension('Test.Compiled', ['source/Uncompiled.pyx'], include_dirs = [np.get_include()])]
setup(
name = 'Test',
package_dir = {'Test':'source'},
packages = ['Test'],
include_dirs = [np.get_include()],
ext_modules=linext,
cmdclass = {'build_ext': build_ext}
)
import cython
def test():
print 'Hello World'
@Dschoni
Copy link
Author

Dschoni commented Aug 18, 2014

test.pyx is in a subfolder /source/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment