Python numpy.get_include() Examples
The following are 30 code examples for showing how to use numpy.get_include(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
You may check out the related API usage on the sidebar.
You may also want to check out all available functions/classes of the module
numpy
, or try the search function
.
Example 1
Project: lambda-packs Author: ryfeus File: setup.py License: MIT License | 7 votes |
def configuration(parent_package='', top_path=None): from numpy import get_include from numpy.distutils.system_info import get_info, NotFoundError from numpy.distutils.misc_util import Configuration lapack_opt = get_info('lapack_opt') if not lapack_opt: raise NotFoundError('no lapack/blas resources found') config = Configuration('_trlib', parent_package, top_path) config.add_extension('_trlib', sources=['_trlib.c', 'trlib_krylov.c', 'trlib_eigen_inverse.c', 'trlib_leftmost.c', 'trlib_quadratic_zero.c', 'trlib_tri_factor.c'], include_dirs=[get_include(), 'trlib'], extra_info=lapack_opt, ) return config
Example 2
Project: pulse2percept Author: pulse2percept File: setup.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('stimuli', parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') if platform.python_implementation() != 'PyPy': config.add_extension('_base', sources=['_base.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_subpackage('tests') config.add_data_dir('data') return config
Example 3
Project: pulse2percept Author: pulse2percept File: setup.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('models', parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') if platform.python_implementation() != 'PyPy': config.add_extension('_beyeler2019', sources=['_beyeler2019.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_extension('_horsager2009', sources=['_horsager2009.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_extension('_nanduri2012', sources=['_nanduri2012.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_subpackage("tests") return config
Example 4
Project: skutil Author: tgsmith61591 File: setup.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def configuration(parent_package="", top_path=None): config = Configuration("metrics", parent_package, top_path) cblas_libs, blas_info = get_blas_info() if os.name == 'posix': cblas_libs.append('m') config.add_extension("_kernel_fast", sources=["_kernel_fast.c"], include_dirs=[os.path.join('..', 'src', 'cblas'), numpy.get_include(), blas_info.pop('include_dirs', [])], libraries=cblas_libs, extra_compile_args=blas_info.pop('extra_compile_args', []), **blas_info) config.add_subpackage('tests') return config
Example 5
Project: pmdarima Author: alkaline-ml File: setup.py License: MIT License | 6 votes |
def configuration(parent_package="", top_path=None): cblas_libs, blas_info = get_blas_info() # Use this rather than cblas_libs so we don't fail on Windows libraries = [] if os.name == 'posix': cblas_libs.append('m') libraries.append('m') config = Configuration("utils", parent_package, top_path) config.add_extension("_array", sources=["_array.pyx"], include_dirs=[numpy.get_include(), blas_info.pop('include_dirs', [])], libraries=libraries, extra_compile_args=blas_info.pop( 'extra_compile_args', []), **blas_info) config.add_subpackage('tests') return config
Example 6
Project: pmdarima Author: alkaline-ml File: setup.py License: MIT License | 6 votes |
def configuration(parent_package="", top_path=None): cblas_libs, blas_info = get_blas_info() # Use this rather than cblas_libs so we don't fail on Windows libraries = [] if os.name == 'posix': cblas_libs.append('m') libraries.append('m') config = Configuration("arima", parent_package, top_path) config.add_extension("_arima", sources=["_arima.pyx"], include_dirs=[numpy.get_include(), # Should this be explicitly included?: '_arima_fast_helpers.h', blas_info.pop('include_dirs', [])], libraries=libraries, extra_compile_args=blas_info.pop( 'extra_compile_args', []), **blas_info) config.add_subpackage('tests') config.add_data_dir('tests/data') return config
Example 7
Project: pmdarima Author: alkaline-ml File: setup.py License: MIT License | 6 votes |
def configuration(parent_package="", top_path=None): cblas_libs, blas_info = get_blas_info() # Use this rather than cblas_libs so we don't fail on Windows libraries = [] if os.name == 'posix': cblas_libs.append('m') libraries.append('m') config = Configuration("exog", parent_package, top_path) config.add_extension("_fourier", sources=["_fourier.pyx"], include_dirs=[numpy.get_include(), blas_info.pop('include_dirs', [])], libraries=libraries, extra_compile_args=blas_info.pop( 'extra_compile_args', []), **blas_info) config.add_subpackage('tests') return config
Example 8
Project: scikit-multiflow Author: scikit-multiflow File: setup.py License: BSD 3-Clause "New" or "Revised" License | 6 votes |
def configuration(parent_package="", top_path=None): config = Configuration("metrics", parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') config.add_extension("_confusion_matrix", sources=["_confusion_matrix.pyx"], include_dirs=[numpy.get_include()], libraries=libraries, extra_compile_args=["-O3"]) config.add_extension("_classification_performance_evaluator", sources=["_classification_performance_evaluator.pyx"], include_dirs=[numpy.get_include()], libraries=libraries, extra_compile_args=["-O3"]) return config
Example 9
Project: quaternion Author: moble File: setup.py License: MIT License | 6 votes |
def finalize_options(self): _build_ext.finalize_options(self) # Prevent numpy from thinking it is still in its setup process: try: __builtins__.__NUMPY_SETUP__ = False except: try: # For python 3 import builtins builtins.__NUMPY_SETUP__ = False except: warn("Skipping numpy hack; if installation fails, try installing numpy first") import numpy self.include_dirs.append(numpy.get_include()) if numpy.__dict__.get('quaternion') is not None: from distutils.errors import DistutilsError raise DistutilsError('The target NumPy already has a quaternion type')
Example 10
Project: Computable Author: ktraunmueller File: setup.py License: MIT License | 6 votes |
def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('csgraph', parent_package, top_path) config.add_data_dir('tests') config.add_extension('_shortest_path', sources=['_shortest_path.c'], include_dirs=[numpy.get_include()]) config.add_extension('_traversal', sources=['_traversal.c'], include_dirs=[numpy.get_include()]) config.add_extension('_min_spanning_tree', sources=['_min_spanning_tree.c'], include_dirs=[numpy.get_include()]) config.add_extension('_tools', sources=['_tools.c'], include_dirs=[numpy.get_include()]) return config
Example 11
Project: dimod Author: dwavesystems File: setup.py License: Apache License 2.0 | 6 votes |
def run(self): # add numpy headers import numpy self.include_dirs.append(numpy.get_include()) # add dimod headers include = os.path.join(os.path.dirname(__file__), 'dimod', 'include') self.include_dirs.append(include) if self.build_tests: test_extensions = [Extension('*', ['tests/test_*'+ext])] if USE_CYTHON: test_extensions = cythonize(test_extensions, # annotate=True ) self.extensions.extend(test_extensions) super().run()
Example 12
Project: Mastering-Elasticsearch-7.0 Author: PacktPublishing File: setup.py License: MIT License | 6 votes |
def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('feature_extraction', parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') if platform.python_implementation() != 'PyPy': config.add_extension('_hashing', sources=['_hashing.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_subpackage("tests") return config
Example 13
Project: Mastering-Elasticsearch-7.0 Author: PacktPublishing File: setup.py License: MIT License | 6 votes |
def configuration(parent_package="", top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration("manifold", parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') config.add_extension("_utils", sources=["_utils.pyx"], include_dirs=[numpy.get_include()], libraries=libraries, extra_compile_args=["-O3"]) config.add_extension("_barnes_hut_tsne", sources=["_barnes_hut_tsne.pyx"], include_dirs=[numpy.get_include()], libraries=libraries, extra_compile_args=['-O3']) config.add_subpackage('tests') return config
Example 14
Project: Mastering-Elasticsearch-7.0 Author: PacktPublishing File: setup.py License: MIT License | 6 votes |
def configuration(parent_package="", top_path=None): config = Configuration("decomposition", parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') config.add_extension("_online_lda", sources=["_online_lda.pyx"], include_dirs=[numpy.get_include()], libraries=libraries) config.add_extension('cdnmf_fast', sources=['cdnmf_fast.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_subpackage("tests") return config
Example 15
Project: Mastering-Elasticsearch-7.0 Author: PacktPublishing File: setup.py License: MIT License | 6 votes |
def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('preprocessing', parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') config.add_extension('_csr_polynomial_expansion', sources=['_csr_polynomial_expansion.pyx'], include_dirs=[numpy.get_include()], libraries=libraries) config.add_subpackage('tests') return config
Example 16
Project: Kaggler Author: jeongyoonlee File: setup.py License: MIT License | 5 votes |
def finalize_options(self): build_ext.finalize_options(self) # prevent numpy from thinking it is still in its setup process: set_builtin('__NUMPY_SETUP__', False) import numpy as np self.include_dirs.append(np.get_include())
Example 17
Project: jwalk Author: jwplayer File: setup.py License: Apache License 2.0 | 5 votes |
def ext_modules(): import numpy walks_ext = Extension('jwalk.walks', ['jwalk/src/walks.pyx'], include_dirs=[numpy.get_include()]) return [walks_ext]
Example 18
Project: genomeview Author: nspies File: setup.py License: MIT License | 5 votes |
def get_includes(): class Includes: def __iter__(self): import pysam import numpy return iter(pysam.get_include()+[numpy.get_include()]) def __getitem__(self, i): return list(self)[i] return Includes()
Example 19
Project: recruit Author: Frank-qlu File: misc_util.py License: Apache License 2.0 | 5 votes |
def get_numpy_include_dirs(): # numpy_include_dirs are set by numpy/core/setup.py, otherwise [] include_dirs = Configuration.numpy_include_dirs[:] if not include_dirs: import numpy include_dirs = [ numpy.get_include() ] # else running numpy/core/setup.py return include_dirs
Example 20
Project: recruit Author: Frank-qlu File: utils.py License: Apache License 2.0 | 5 votes |
def get_include(): """ Return the directory that contains the NumPy \\*.h header files. Extension modules that need to compile against NumPy should use this function to locate the appropriate include directory. Notes ----- When using ``distutils``, for example in ``setup.py``. :: import numpy as np ... Extension('extension_name', ... include_dirs=[np.get_include()]) ... """ import numpy if numpy.show_config is None: # running from numpy source directory d = os.path.join(os.path.dirname(numpy.__file__), 'core', 'include') else: # using installed numpy core headers import numpy.core as core d = os.path.join(os.path.dirname(core.__file__), 'include') return d
Example 21
Project: recruit Author: Frank-qlu File: test_regression.py License: Apache License 2.0 | 5 votes |
def test_include_dirs(self): # As a sanity check, just test that get_include # includes something reasonable. Somewhat # related to ticket #1405. include_dirs = [np.get_include()] for path in include_dirs: assert_(isinstance(path, (str, unicode))) assert_(path != '')
Example 22
Project: tsinfer Author: tskit-dev File: setup.py License: GNU General Public License v3.0 | 5 votes |
def finalize_options(self): super(build_ext, self).finalize_options() # Prevent numpy from thinking it is still in its setup process: __builtins__.__NUMPY_SETUP__ = False import numpy self.include_dirs.append(numpy.get_include())
Example 23
Project: tenpy Author: tenpy File: setup.py License: GNU General Public License v3.0 | 5 votes |
def setup_cython_extension(): try: from Cython.Build import cythonize except: return [] # see tenpy/tools/optimization.py for details on "TENPY_OPTIMIZE" TENPY_OPTIMIZE = int(os.getenv('TENPY_OPTIMIZE', 1)) include_dirs = [numpy.get_include()] libs = [] lib_dirs = [] extensions = [ Extension("*", ["tenpy/linalg/*.pyx"], include_dirs=include_dirs, libraries=libs, library_dirs=lib_dirs, language='c++') ] comp_direct = { # compiler_directives 'language_level': 3, # use python 3 'embedsignature': True, # write function signature in doc-strings } if TENPY_OPTIMIZE > 1: comp_direct['initializedcheck'] = False comp_direct['boundscheck'] = False if TENPY_OPTIMIZE < 1: comp_direct['profile'] = True comp_direct['linetrace'] = True # compile time flags (#DEF ...) comp_flags = {'TENPY_OPTIMIZE': TENPY_OPTIMIZE} ext_modules = cythonize(extensions, compiler_directives=comp_direct, compile_time_env=comp_flags) return ext_modules
Example 24
Project: dexplo Author: dexplo File: setup.py License: BSD 3-Clause "New" or "Revised" License | 5 votes |
def run(self): # Import numpy here, only when headers are needed import numpy # Add numpy headers to include_dirs self.include_dirs.append(numpy.get_include()) # Call original build_ext command build_ext.run(self)
Example 25
Project: rankeval Author: hpclab File: setup.py License: Mozilla Public License 2.0 | 5 votes |
def finalize_options(self): build_ext.finalize_options(self) # Prevent numpy from thinking it is still in its setup process: # https://docs.python.org/2/library/__builtin__.html#module-__builtin__ if isinstance(__builtins__, dict): __builtins__["__NUMPY_SETUP__"] = False else: __builtins__.__NUMPY_SETUP__ = False import numpy as np self.include_dirs.append(np.get_include())
Example 26
Project: lambda-packs Author: ryfeus File: misc_util.py License: MIT License | 5 votes |
def get_numpy_include_dirs(): # numpy_include_dirs are set by numpy/core/setup.py, otherwise [] include_dirs = Configuration.numpy_include_dirs[:] if not include_dirs: import numpy include_dirs = [ numpy.get_include() ] # else running numpy/core/setup.py return include_dirs
Example 27
Project: lambda-packs Author: ryfeus File: utils.py License: MIT License | 5 votes |
def get_include(): """ Return the directory that contains the NumPy \\*.h header files. Extension modules that need to compile against NumPy should use this function to locate the appropriate include directory. Notes ----- When using ``distutils``, for example in ``setup.py``. :: import numpy as np ... Extension('extension_name', ... include_dirs=[np.get_include()]) ... """ import numpy if numpy.show_config is None: # running from numpy source directory d = os.path.join(os.path.dirname(numpy.__file__), 'core', 'include') else: # using installed numpy core headers import numpy.core as core d = os.path.join(os.path.dirname(core.__file__), 'include') return d
Example 28
Project: lambda-packs Author: ryfeus File: setup.py License: MIT License | 5 votes |
def configuration(parent_package='', top_path=None): import numpy from numpy.distutils.misc_util import Configuration config = Configuration('csgraph', parent_package, top_path) config.add_data_dir('tests') config.add_extension('_shortest_path', sources=['_shortest_path.c'], include_dirs=[numpy.get_include()]) config.add_extension('_traversal', sources=['_traversal.c'], include_dirs=[numpy.get_include()]) config.add_extension('_min_spanning_tree', sources=['_min_spanning_tree.c'], include_dirs=[numpy.get_include()]) config.add_extension('_reordering', sources=['_reordering.c'], include_dirs=[numpy.get_include()]) config.add_extension('_tools', sources=['_tools.c'], include_dirs=[numpy.get_include()]) return config
Example 29
Project: lambda-packs Author: ryfeus File: setup.py License: MIT License | 5 votes |
def configuration(parent_package='', top_path=None): config = Configuration('ndimage', parent_package, top_path) include_dirs = ['src', get_include(), os.path.join(os.path.dirname(__file__), '..', '_lib', 'src')] config.add_extension("_nd_image", sources=["src/nd_image.c","src/ni_filters.c", "src/ni_fourier.c","src/ni_interpolation.c", "src/ni_measure.c", "src/ni_morphology.c","src/ni_support.c"], include_dirs=include_dirs, **numpy_nodepr_api) # Cython wants the .c and .pyx to have the underscore. config.add_extension("_ni_label", sources=["src/_ni_label.c",], include_dirs=['src']+[get_include()]) config.add_extension("_ctest", sources=["src/_ctest.c"], include_dirs=[get_include()], **numpy_nodepr_api) _define_macros = [("OLDAPI", 1)] if 'define_macros' in numpy_nodepr_api: _define_macros.extend(numpy_nodepr_api['define_macros']) config.add_extension("_ctest_oldapi", sources=["src/_ctest.c"], include_dirs=[get_include()], define_macros=_define_macros) config.add_extension("_cytest", sources=["src/_cytest.c"]) config.add_data_dir('tests') return config
Example 30
Project: lambda-packs Author: ryfeus File: utils.py License: MIT License | 5 votes |
def get_include(): """ Return the directory that contains the NumPy \\*.h header files. Extension modules that need to compile against NumPy should use this function to locate the appropriate include directory. Notes ----- When using ``distutils``, for example in ``setup.py``. :: import numpy as np ... Extension('extension_name', ... include_dirs=[np.get_include()]) ... """ import numpy if numpy.show_config is None: # running from numpy source directory d = os.path.join(os.path.dirname(numpy.__file__), 'core', 'include') else: # using installed numpy core headers import numpy.core as core d = os.path.join(os.path.dirname(core.__file__), 'include') return d