Re: [Numpy-discussion] How do I ensure numpy headers are present in setup.py?
Hmm, unfortunate. So the best approach then is probably just to tell people to install numpy first, then my package? On Fri, Apr 2, 2010 at 12:06 PM, Robert Kern robert.k...@gmail.com wrote: On Fri, Apr 2, 2010 at 13:03, Erik Tollerud erik.tolle...@gmail.com wrote: I am writing a setup.py file for a package that will use cython with numpy integration. This of course requires the numpy header files, which I am including by using numpy.get_includes in the setup.py file below. The problem is for users that have not installed numpy before installing this package. If they have setuptools installed, the behavior I would want would be for numpy to be downloaded and then the setup script should be able to get at the headers even if it doesn't install numpy until after this package is installed. But that doesn't work - I have to import numpy in the setup script, which fails if it is not yet installed. So How can I get the behavior I want? You can't, not without some hacks to distutils. This is a basic problem with the way setuptools uses arguments to setup() to get the dependencies. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How do I ensure numpy headers are present in setup.py?
On Mon, Apr 5, 2010 at 11:28 AM, Robert Kern robert.k...@gmail.com wrote: On Mon, Apr 5, 2010 at 13:26, Erik Tollerud erik.tolle...@gmail.com wrote: Hmm, unfortunate. So the best approach then is probably just to tell people to install numpy first, then my package? Yup. And really, this isn't that unreasonable. Not only does this make users more aware of their environment (ie, the distinction between your package and the major numerical package in Python), but its so much cleaner. With the combined approach, any NumPy installation problems would be (frequently) associated with your package. On the other hand, if there are any NumPy installation problems in the separated approach, at least your package is blameless. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How do I ensure numpy headers are present in setup.py?
On Sat, Apr 3, 2010 at 12:17 AM, josef.p...@gmail.com wrote: On Fri, Apr 2, 2010 at 11:45 PM, Chris Colbert sccolb...@gmail.com wrote: On Fri, Apr 2, 2010 at 3:03 PM, Erik Tollerud erik.tolle...@gmail.com wrote: you could try something like this (untested): if __name__ == '__main__': try: import numpy except ImportError: import subprocess subprocess.check_call(['easy_install', 'numpy']) # will except if call fails Personally, I don't like it at all if packages automatically easy_install big dependencies like numpy especially if it is connected to a version requirement. Is it possible to kill an installation subprocess with CRTL-C ? Hmm, that's a good question. Just thinking about it, I don't think it would. From the docs: Popen.kill() Kills the child. On Posix OSs the function sends SIGKILL to the child. On Windows kill() is an alias for terminate(). But, I listed the check_call() function, which waits for the subprocess to end. You never actually get the handle to the subprocess object to issue the kill() command. So, I'm not sure how you could make it work. Josef ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] How do I ensure numpy headers are present in setup.py?
I am writing a setup.py file for a package that will use cython with numpy integration. This of course requires the numpy header files, which I am including by using numpy.get_includes in the setup.py file below. The problem is for users that have not installed numpy before installing this package.If they have setuptools installed, the behavior I would want would be for numpy to be downloaded and then the setup script should be able to get at the headers even if it doesn't install numpy until after this package is installed. But that doesn't work - I have to import numpy in the setup script, which fails if it is not yet installed. So How can I get the behavior I want? setup.py from distribute_setup import use_setuptools use_setuptools() from setuptools import setup from setuptools.extension import Extension from Cython.Distutils import build_ext from numpy import get_include as numpy_includes ext_modules = [Extension(myext, [core.pyx,somecfile.c],include_dirs=[numpy_includes()])] setup( name = 'ext name', cmdclass = {'build_ext': build_ext}, ext_modules = ext_modules, setup_requires=['numpy'], install_requires=['numpy'], ) ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How do I ensure numpy headers are present in setup.py?
On Fri, Apr 2, 2010 at 13:03, Erik Tollerud erik.tolle...@gmail.com wrote: I am writing a setup.py file for a package that will use cython with numpy integration. This of course requires the numpy header files, which I am including by using numpy.get_includes in the setup.py file below. The problem is for users that have not installed numpy before installing this package. If they have setuptools installed, the behavior I would want would be for numpy to be downloaded and then the setup script should be able to get at the headers even if it doesn't install numpy until after this package is installed. But that doesn't work - I have to import numpy in the setup script, which fails if it is not yet installed. So How can I get the behavior I want? You can't, not without some hacks to distutils. This is a basic problem with the way setuptools uses arguments to setup() to get the dependencies. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How do I ensure numpy headers are present in setup.py?
On Fri, Apr 2, 2010 at 3:03 PM, Erik Tollerud erik.tolle...@gmail.comwrote: you could try something like this (untested): if __name__ == '__main__': try: import numpy except ImportError: import subprocess subprocess.check_call(['easy_install', 'numpy']) # will except if call fails ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] How do I ensure numpy headers are present in setup.py?
On Fri, Apr 2, 2010 at 11:45 PM, Chris Colbert sccolb...@gmail.com wrote: On Fri, Apr 2, 2010 at 3:03 PM, Erik Tollerud erik.tolle...@gmail.com wrote: you could try something like this (untested): if __name__ == '__main__': try: import numpy except ImportError: import subprocess subprocess.check_call(['easy_install', 'numpy']) # will except if call fails Personally, I don't like it at all if packages automatically easy_install big dependencies like numpy especially if it is connected to a version requirement. Is it possible to kill an installation subprocess with CRTL-C ? Josef ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion