Conversation
|
Hey @121onto, thanks a lot for the contribution! I cannot really test it with python 3.5 right now, but I decided to go ahead with the merge anyway - we can fix things after the holidays. With Python 2.7.3, there is a compilation issue: |
|
Interesting. I downloaded the latest anaconda release for python 2.7 and was able to compile things. Here is my version info: $ python -c 'import sys, cython; print sys.version, "\n", cython.__version__'
2.7.11...
0.23.4Are you willing to install the latest Anaconda build and try again? Its super easy to do. Everything gets placed in If it is a version issue, we should make that explicit in Edited on Wed Dec 23 10:36:42 PST 2015 import sys, os
from Cython.Build import cythonize
from distutils.version import LooseVersion
import numpy as np
try:
from setuptools import setup, Extension
_have_setuptools = True
except ImportError:
# no setuptools installed
from distutils.core import setup, Extension
_have_setuptools = False
setuptools_kwargs = {}
min_cython_ver = '0.23.4'
try:
import Cython
except ImportError:
sys.exit('You are missing Cython. Install with:'
'\n$ pip install cython')
try:
cython_ver = Cython.__version__
assert(cython_ver >= LooseVersion(min_cython_ver))
except AssertionError:
sys.exit('Your version of Cython is not supported. '
'Upgrade with: '
'\n$ pip install cython --upgrade')
# create build dir if it doesn't already exist
try:
os.makedirs('libsdca')
except OSError:
if not os.path.isdir('libsdca'):
raise
# Modifiy this if BLAS and LAPACK libraries are not in /usr/lib.
BLAS_LIB_DIR = '/usr/lib'
BLAS_LIB = ['blas']
LAPACK_LIB = ['lapack']
BLAS_COMPILE_ARGS = ['-DBLAS_DEFAULT_LOCAL_HEADER']
BASE_COMPILE_ARGS = ['-std=c++11', '-lstdc++']
BASE_LINK_ARGS = ['-std=c++11', '-lstdc++']
INCLUDE_DIRS = [np.get_include(), '../']
extension = Extension(name = 'libsdca',
language = 'c++',
libraries = LAPACK_LIB + BLAS_LIB,
include_dirs = INCLUDE_DIRS,
library_dirs = [ BLAS_LIB_DIR ],
extra_compile_args = BASE_COMPILE_ARGS + BLAS_COMPILE_ARGS,
extra_link_args = BASE_LINK_ARGS,
sources = ['libsdca.pyx'])
setup(name = 'libsdca',
description = 'Python wrappers for libsdca.',
version = '0.0.1',
long_description = '''
Python wrappers for libsdca.
libsdca is a library for multiclass classification
based on stochastic dual coordinate ascent (SDCA).
''',
author = '121onto',
author_email = '121onto@gmail.com',
ext_package = 'libsdca',
ext_modules = cythonize(extension),
packages = 'libsdca',
classifiers = [
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Science/Research',
'Operating System :: OS Independent',
'Programming Language :: C++',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering',
],
**setuptools_kwargs
) |
I wrote some wrappers that make it easy to use the libsdca library with Python 3.5. I tried to stick with your coding conventions. One exception is that I use
distutilsand Cython to build things (not too familiar with cmake).The wrappers could use a user-friendly interface, to help with trouble-shooting potential bugs. Wouldn't be too difficult to write a nice python class for this purpose.
Would love to hear any feedback or thoughts on this.