Python numpy.get_include() Examples
The following are 30
code examples of numpy.get_include().
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 also want to check out all available functions/classes of the module
numpy
, or try the search function
.
Example #1
Source File: setup.py From lambda-packs with 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
Source File: setup.py From pmdarima with 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 #3
Source File: setup.py From Mastering-Elasticsearch-7.0 with 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 #4
Source File: setup.py From Mastering-Elasticsearch-7.0 with 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 #5
Source File: setup.py From Mastering-Elasticsearch-7.0 with 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 #6
Source File: setup.py From Mastering-Elasticsearch-7.0 with 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 #7
Source File: setup.py From skutil with 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 #8
Source File: setup.py From pmdarima with 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 #9
Source File: setup.py From pmdarima with 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 #10
Source File: setup.py From dimod with 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 #11
Source File: setup.py From Computable with 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 #12
Source File: setup.py From scikit-multiflow with 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 #13
Source File: setup.py From pulse2percept with 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 #14
Source File: setup.py From pulse2percept with 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 #15
Source File: setup.py From quaternion with 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 #16
Source File: setup.py From florence with MIT License | 5 votes |
def GetNumPyPath(self): numpy_version = np.__version__ if int(numpy_version.split('.')[0])==1 and int(numpy_version.split('.')[1]) < 8: raise RuntimeError("Numpy version >= 1.8 required") elif int(numpy_version.split('.')[0]) < 1: raise RuntimeError("Numpy version >= 1.8 required") self.numpy_include_path = np.get_include()
Example #17
Source File: setup.py From sparse_dot_topn with Apache License 2.0 | 5 votes |
def my_build_ext(pars): # import delayed: from setuptools.command.build_ext import build_ext as _build_ext class build_ext(_build_ext): def finalize_options(self): _build_ext.finalize_options(self) # Prevent numpy from thinking it is still in its setup process: __builtins__.__NUMPY_SETUP__ = False import numpy self.include_dirs.append(numpy.get_include()) #object returned: return build_ext(pars)
Example #18
Source File: setup.py From DeepForest with MIT License | 5 votes |
def finalize_options(self, *args, **kwargs): ret = self._command.finalize_options(*args, **kwargs) import numpy self.include_dirs.append(numpy.get_include()) return ret
Example #19
Source File: setup.py From mmdetection-annotated with Apache License 2.0 | 5 votes |
def make_cython_ext(name, module, sources): extra_compile_args = None if platform.system() != 'Windows': extra_compile_args = { 'cxx': ['-Wno-unused-function', '-Wno-write-strings'] } extension = Extension( '{}.{}'.format(module, name), [os.path.join(*module.split('.'), p) for p in sources], include_dirs=[np.get_include()], language='c++', extra_compile_args=extra_compile_args) extension, = cythonize(extension) return extension
Example #20
Source File: setup.py From xtensor-python-cookiecutter with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __str__(self): import pybind11 return pybind11.get_include(self.user)
Example #21
Source File: setup.py From mdlp-discretization with BSD 3-Clause "New" or "Revised" License | 5 votes |
def run(self): import numpy self.include_dirs.append(numpy.get_include()) build_ext.run(self)
Example #22
Source File: setup.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def configuration(parent_package="", top_path=None): config = Configuration("tree", parent_package, top_path) libraries = [] if os.name == 'posix': libraries.append('m') config.add_extension("_tree", sources=["_tree.pyx"], include_dirs=[numpy.get_include()], libraries=libraries, extra_compile_args=["-O3"]) config.add_extension("_splitter", sources=["_splitter.pyx"], include_dirs=[numpy.get_include()], libraries=libraries, extra_compile_args=["-O3"]) config.add_extension("_criterion", sources=["_criterion.pyx"], include_dirs=[numpy.get_include()], libraries=libraries, extra_compile_args=["-O3"]) config.add_extension("_utils", sources=["_utils.pyx"], include_dirs=[numpy.get_include()], libraries=libraries, extra_compile_args=["-O3"]) config.add_subpackage("tests") config.add_data_files("_criterion.pxd") config.add_data_files("_splitter.pxd") config.add_data_files("_tree.pxd") config.add_data_files("_utils.pxd") return config
Example #23
Source File: test_regression.py From Mastering-Elasticsearch-7.0 with MIT License | 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 #24
Source File: utils.py From Mastering-Elasticsearch-7.0 with 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 #25
Source File: misc_util.py From Mastering-Elasticsearch-7.0 with 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 #26
Source File: utils.py From Computable with 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 #27
Source File: setup.py From bhmm with GNU Lesser General Public License v3.0 | 5 votes |
def extensions(): from Cython.Build import cythonize from numpy import get_include np_inc = get_include() extensions = [ Extension('bhmm.hidden.impl_c.hidden', sources = ['./bhmm/hidden/impl_c/hidden.pyx', './bhmm/hidden/impl_c/_hidden.c'], include_dirs = ['/bhmm/hidden/impl_c/', np_inc]), Extension('bhmm.output_models.impl_c.discrete', sources = ['./bhmm/output_models/impl_c/discrete.pyx', './bhmm/output_models/impl_c/_discrete.c'], include_dirs = ['/bhmm/output_models/impl_c/', np_inc]), Extension('bhmm.output_models.impl_c.gaussian', sources = ['./bhmm/output_models/impl_c/gaussian.pyx', './bhmm/output_models/impl_c/_gaussian.c'], include_dirs = ['/bhmm/output_models/impl_c/', np_inc]), Extension('bhmm._external.clustering.kmeans_clustering_64', sources=['./bhmm/_external/clustering/src/clustering.c', './bhmm/_external/clustering/src/kmeans.c'], include_dirs=['./bhmm/_external/clustering/include', np_inc], extra_compile_args=['-std=c99','-O3', '-DCLUSTERING_64']), Extension('bhmm._external.clustering.kmeans_clustering_32', sources=['./bhmm/_external/clustering/src/clustering.c', './bhmm/_external/clustering/src/kmeans.c'], include_dirs=['./bhmm/_external/clustering/include', np_inc], extra_compile_args=['-std=c99','-O3']), ] return cythonize(extensions)
Example #28
Source File: test_regression.py From Computable with MIT License | 5 votes |
def test_include_dirs(self): """As a sanity check, just test that get_include and get_numarray_include include something reasonable. Somewhat related to ticket #1405.""" include_dirs = [np.get_include(), np.get_numarray_include()] for path in include_dirs: assert_(isinstance(path, (str, unicode))) assert_(path != '')
Example #29
Source File: utils.py From Computable with MIT License | 5 votes |
def get_numarray_include(type=None): """ Return the directory that contains the numarray \\*.h header files. Extension modules that need to compile against numarray should use this function to locate the appropriate include directory. Parameters ---------- type : any, optional If `type` is not None, the location of the NumPy headers is returned as well. Returns ------- dirs : str or list of str If `type` is None, `dirs` is a string containing the path to the numarray headers. If `type` is not None, `dirs` is a list of strings with first the path(s) to the numarray headers, followed by the path to the NumPy headers. Notes ----- Useful when using ``distutils``, for example in ``setup.py``. :: import numpy as np ... Extension('extension_name', ... include_dirs=[np.get_numarray_include()]) ... """ from numpy.numarray import get_numarray_include_dirs include_dirs = get_numarray_include_dirs() if type is None: return include_dirs[0] else: return include_dirs + [get_include()]
Example #30
Source File: setup.py From modl with BSD 2-Clause "Simplified" License | 5 votes |
def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('math', parent_package, top_path) extensions = [Extension('modl.utils.math.enet', sources=['modl/utils/math/enet.pyx'], include_dirs=[numpy.get_include()], ), ] config.ext_modules += extensions config.add_subpackage('tests') return config