EPD numpy headers not found on OS X 10.6

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

EPD numpy headers not found on OS X 10.6

Erik Tollerud
I've installed the 32-bit EPD 6.1 on OS X 10.6, but I've encountered a
problem... I'm trying to use cython to convert parts of a C library to
python using numpy arrays, and the compiler (gcc, I think the one that
came with Xcode) can't locate the numpy headers.  It fails with a
bunch of errors that all seem to stem from not finding
"numpy/arrayobject.h" and "numpy/ufuncobject.h" .  Do I have to
explicitly point the setup.py file somewhere in OS X, or do something
special during the installation?
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: EPD numpy headers not found on OS X 10.6

Ilan Schnell
Hello, yes numpy installs it's headers in site-packages next to
Python files.  So you have to explicitly set your include path, e.g.:
/Library/Frameworks/Python.framework/Versions/6.1/lib/python2.6/site-
packages/numpy/core/include/numpy

- Ilan


On Mar 30, 2010, at 5:19 PM, Erik Tollerud wrote:

> I've installed the 32-bit EPD 6.1 on OS X 10.6, but I've encountered a
> problem... I'm trying to use cython to convert parts of a C library to
> python using numpy arrays, and the compiler (gcc, I think the one that
> came with Xcode) can't locate the numpy headers.  It fails with a
> bunch of errors that all seem to stem from not finding
> "numpy/arrayobject.h" and "numpy/ufuncobject.h" .  Do I have to
> explicitly point the setup.py file somewhere in OS X, or do something
> special during the installation?
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: EPD numpy headers not found on OS X 10.6

Robert Kern
In reply to this post by Erik Tollerud
On Tue, Mar 30, 2010 at 5:19 PM, Erik Tollerud <[hidden email]> wrote:
> I've installed the 32-bit EPD 6.1 on OS X 10.6, but I've encountered a
> problem... I'm trying to use cython to convert parts of a C library to
> python using numpy arrays, and the compiler (gcc, I think the one that
> came with Xcode) can't locate the numpy headers.  It fails with a
> bunch of errors that all seem to stem from not finding
> "numpy/arrayobject.h" and "numpy/ufuncobject.h" .  Do I have to
> explicitly point the setup.py file somewhere in OS X, or do something
> special during the installation?

numpy headers are included in the numpy package itself (on all
platforms and distributions). You need to pass
include_dirs=[numpy.get_include()] to your Extension() constructor.

--
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
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: EPD numpy headers not found on OS X 10.6

Erik Tollerud
Aha!  the numpy.get_include() worked for locating the numpy headers
(and it's the same directory as suggested by Ilan).  Curious that it
wasn't necessary when compiling under Ubuntu... at any rate, it now
finds the numpy headers...

But I'm encountering other compilation errors now - specifically, the
compiler does not seem to be finding the "bool_t" type in the header
I'm trying to include. I'm not sure this is numpy-related, anymore,
but it still seems to be tied to either EPD, python, or cython... if I
just compile a pure-C program that calls the same points in the header
it compiles perfectly... only with cython does it seem to get
confused...


On Tue, Mar 30, 2010 at 3:33 PM, Robert Kern <[hidden email]> wrote:

> On Tue, Mar 30, 2010 at 5:19 PM, Erik Tollerud <[hidden email]> wrote:
>> I've installed the 32-bit EPD 6.1 on OS X 10.6, but I've encountered a
>> problem... I'm trying to use cython to convert parts of a C library to
>> python using numpy arrays, and the compiler (gcc, I think the one that
>> came with Xcode) can't locate the numpy headers.  It fails with a
>> bunch of errors that all seem to stem from not finding
>> "numpy/arrayobject.h" and "numpy/ufuncobject.h" .  Do I have to
>> explicitly point the setup.py file somewhere in OS X, or do something
>> special during the installation?
>
> numpy headers are included in the numpy package itself (on all
> platforms and distributions). You need to pass
> include_dirs=[numpy.get_include()] to your Extension() constructor.
>
> --
> 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
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: EPD numpy headers not found on OS X 10.6

Robert Kern
On Tue, Mar 30, 2010 at 9:48 PM, Erik Tollerud <[hidden email]> wrote:
> Aha!  the numpy.get_include() worked for locating the numpy headers
> (and it's the same directory as suggested by Ilan).  Curious that it
> wasn't necessary when compiling under Ubuntu... at any rate, it now
> finds the numpy headers...

Ubuntu probably "fixed" numpy by putting the headers under
/usr/include/python2.x/.

> But I'm encountering other compilation errors now - specifically, the
> compiler does not seem to be finding the "bool_t" type in the header
> I'm trying to include. I'm not sure this is numpy-related, anymore,
> but it still seems to be tied to either EPD, python, or cython... if I
> just compile a pure-C program that calls the same points in the header
> it compiles perfectly... only with cython does it seem to get
> confused...

"bool_t" doesn't appear anywhere in the numpy, Python, or Cython
codebases. It is possible that whatever is typedefing it may be doing
it under an #ifdef that happens to be inactive given the other
#includes. You will have to figure that out yourself since we don't
know your code.

--
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
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: EPD numpy headers not found on OS X 10.6

Erik Tollerud
Very curiously, the fix for this problem was to adjust one of the
headers in OS X to include a file that all the other versions of that
file included.  Apparently the python extension compiler is finding a
different version of the hearder than gcc did.  Odd, but at any rate,
it compiles fine now with the added #include.  Thanks!

On Tue, Mar 30, 2010 at 9:08 PM, Robert Kern <[hidden email]> wrote:

> On Tue, Mar 30, 2010 at 9:48 PM, Erik Tollerud <[hidden email]> wrote:
>> Aha!  the numpy.get_include() worked for locating the numpy headers
>> (and it's the same directory as suggested by Ilan).  Curious that it
>> wasn't necessary when compiling under Ubuntu... at any rate, it now
>> finds the numpy headers...
>
> Ubuntu probably "fixed" numpy by putting the headers under
> /usr/include/python2.x/.
>
>> But I'm encountering other compilation errors now - specifically, the
>> compiler does not seem to be finding the "bool_t" type in the header
>> I'm trying to include. I'm not sure this is numpy-related, anymore,
>> but it still seems to be tied to either EPD, python, or cython... if I
>> just compile a pure-C program that calls the same points in the header
>> it compiles perfectly... only with cython does it seem to get
>> confused...
>
> "bool_t" doesn't appear anywhere in the numpy, Python, or Cython
> codebases. It is possible that whatever is typedefing it may be doing
> it under an #ifdef that happens to be inactive given the other
> #includes. You will have to figure that out yourself since we don't
> know your code.
>
> --
> 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
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: EPD numpy headers not found on OS X 10.6

Gael Varoquaux
In reply to this post by Robert Kern
On Tue, Mar 30, 2010 at 10:08:31PM -0600, Robert Kern wrote:
> On Tue, Mar 30, 2010 at 9:48 PM, Erik Tollerud <[hidden email]> wrote:
> > Aha!  the numpy.get_include() worked for locating the numpy headers
> > (and it's the same directory as suggested by Ilan).  Curious that it
> > wasn't necessary when compiling under Ubuntu... at any rate, it now
> > finds the numpy headers...

> Ubuntu probably "fixed" numpy by putting the headers under
> /usr/include/python2.x/.

Which is a bug, and has been reported, because it means that if several
versions of numpy are installed (for instance locally, by a user), the
wrong headers will be picked up.

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev