-
Hi, I'm developing a package that contains a C extension which use As I don't know "where" is that header in the cloud I find it using this command: $(python -c 'import numpy, os; print(os.path.dirname(numpy.__file__))')/core/include/numpy I've tried to set that enviroment variable using: [tool.cibuildwheel]
environment = { C_INCLUDE_PATH="$(python -c 'import numpy, os; print(os.path.dirname(numpy.__file__))')/core/include/numpy" } But it sais numpy is not installed, even when I've tried: [tool.cibuildwheel]
before-build = [ "pip install numpy" ]
It seems that enviroment variables are setted before all. I know i can use the So, how can I include this path? Is a better way to do this that I'm missing? Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Without seeing the actual config (do you have a link?) it's hard to answer. EDIT: from setuptools import Extension, setup, find_packages
+ import numpy as np
+
setup(
name="fdce",
version="0.1.1a3",
description="Finite difference coefficient estimator",
author="Jorge Morgado Vega",
author_email="[email protected]",
requires=["numpy"],
packages=find_packages(),
python_requires=">=3.8",
ext_modules=[
- Extension("fdce._extension._fdce", ["fdce/_extension/_fdce.c"]),
+ Extension("fdce._extension._fdce", ["fdce/_extension/_fdce.c"], include_dirs=[np.get_include()]),
]
) |
Beta Was this translation helpful? Give feedback.
Without seeing the actual config (do you have a link?) it's hard to answer.
Usually, as you noted,
numpy
shall be specified inbuild-system.requires
and in fact, you probably wantoldest-supported-numpy
in there rather thannumpy
.The rest will depend on your actual build system.
With setuptools, you'd use
np.get_include()
something likeExtension('foo', ['foo.c'], include_dirs=[np.get_include()])
EDIT:
I'm guessing it's for https://github.com/jmorgadov/fdce
If I'm guessing right, I think that adding
oldest-supported-numpy
tobuild-system.requires
and changingsetup.py
as follow will do (you don't needenvironment
orbefore-build
settings here):