cython works fine on winpython but not on anaconda - linking issue -


i have cython code runs , works fine under winpython giving me issues when switch winpython anaconda3. using python 3.4

the test code :

# cython: boundscheck=false # cython: wraparound=false # cython: cdivision=true  cimport cython cimport numpy np import numpy np numpy cimport ndarray ar libc.math cimport *   cpdef ar[double, ndim=1, mode='c'] test(ar[double, ndim=1, mode='c'] x):     cdef:         int n = x.shape[0]         py_ssize_t         ar[double, ndim=1, mode='c'] y = np.zeros(n)*np.nan     nogil:         in range(0, n):             y[i] = x[i]+1     return y 

the compilation code is:

from distutils.core import setup distutils.extension import extension cython.distutils import build_ext import numpy np  ext_modules = [extension('test', ['tech/test.pyx'], include_dirs=[np.get_include()],                          define_macros=[('npy_no_deprecated_api', none)],                          extra_compile_args=['-o3', '-march=native', '-ffast-math'],                          libraries=['m']                          )]  setup(     name="test function",     cmdclass={'build_ext': build_ext},     ext_modules=ext_modules ) 

i using mingw compile, under ...\anaconda3\lib\distutils folder have file has

[build] compiler = mingw32 

in addition in path environment variables, have:

default: ...\anaconda3 ...\anaconda3\scripts

also added: ...\anaconda3\libs (this contains python34)

also added: mingw32 files copied winpython contain gcc etc: ...\anaconda3\tools\tools\mingw32\bin (this contains gcc) ...\anaconda3\tools\tools\mingw32\x86_64-w64-mingw32\bin

when try:

python setup.py build_ext --inplace 

the code runs fine until test.c, test.o , test.def have been generated. thereafter get:

c:\anaconda3\tools\tools\mingw32\bin\gcc.exe -shared -s build\temp.win-amd64-3.4\release\tech\test.o build\temp.win-amd64-3.4\release\tech\test.def -lc:\anaconda3\libs -lc:\anaconda3\pcbuild\amd64 -lm -lpython34 -lmsvcr100 - 

o p:\documents\temp\python-master\python-master\common\test.pyd

build\temp.win-amd64-3.4\release\tech\test.o:test.c:(.text+0x8e): undefined reference `__imp_pyexc_typeerror'  build\temp.win-amd64-3.4\release\tech\test.o:test.c:(.text+0x10e): undefined reference `__imp_pyexc_valueerror'  build\temp.win-amd64-3.4\release\tech\test.o:test.c:(.text+0x259): undefined reference `__imp__pythreadstate_current' .... .... c:/anaconda3/tools/tools/mingw32/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw3                ild\temp.win-amd64-3.4\release\tech\test.o: bad reloc address 0x0 in section `.data' collect2.exe: error: ld returned 1 exit status                                                                         error: command 'c:\\anaconda3\\tools\\tools\\mingw32\\bin\\gcc.exe' failed exit status 1    
  1. first of all, couldn't find anacond3\pcbuild\amd64 directory/file anywhere.

  2. i tried on internet, couldn't find reference __imp_pyexc_typeerror, __imp__pythreadstate_current, __imp_pyexc_valueerror.

what going wrong final conversion *.pyd file?

i suspect anaconda doesn't support mingw-64 yet.

historically mingw-64 indeed hopeless idea until cark kleffner came static version.

things may (should ?) change when carl's updated version available mingwpy wheel.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -