Closed utterances-bot closed 3 weeks ago
I'm curious if you purposely left out the numpy part in the solution?
include_dirs=[numpy.get_include()]
@lasofivec, thanks for your feedback!
No, that was not intentional - I change the post.
In that case, from my experience the wrapping solution won't work. Or at least I didn't find a way of wrapping the numpy.get_include()
in a clever way. Seems to me like using a newer version of setuptools
is the only working solution (or explicit installing it, like in your last code snippet)
not a super clever way, but a way :
class WhateverExt(Extension): def init(self, *args, *kwargs): self._include = [] super().init(args, **kwargs)
@property
def include_dirs(self):
# defer import of numpy
import numpy
return self._include + [numpy.get_include()]
@include_dirs.setter
def include_dirs(self, dirs):
self._include = dirs
ext_modules = [ WhateverExt( name="stuff.stuff", sources=["src/stuff/stuff.pyx"], )]
@jacboi What version of setuptools
did you use ?
Resolve cython and numpy dependencies on setup step
Describing how to resolve cython and numpy dependencies on setup step.
https://luminousmen.com/post/resolve-cython-and-numpy-dependencies