Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error #14

Closed
jbloit opened this issue Sep 27, 2013 · 10 comments
Closed

Compilation error #14

jbloit opened this issue Sep 27, 2013 · 10 comments
Labels
Milestone

Comments

@jbloit
Copy link

jbloit commented Sep 27, 2013

Hi,
I'm trying to have a remote collaborator install essentia on his machine, and the compilation fails (I think at the python bindings step). Here's the first error :

In file included from ../src/python/pytypes/boolean.cpp:20:
/Users/jspindell/Desktop/essentia/src/python/typedefs.h:26:10: fatal error: 'numpy/ndarrayobject.h' file not found

include "numpy/ndarrayobject.h"

          ^

We located the numpy core headers folder on his machine and tried to export CFGLAGS :

export CFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/
export CPPFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/

but that didn't help. Do your have any suggestion?

The machine is running macosx with mountain lion.

Thank you!

@dbogdanov
Copy link
Member

You might need to install numpy via homebrew. Please, tell if that works for you.

@jbloit
Copy link
Author

jbloit commented Nov 28, 2013

Hmm, I can't remember how I fixed it exactly this was a while ago, but it might be with the homebrew version indeed. FYI I also ended up using it with the Anaconda distribution and it works well.

Thank you for your answer.

@justinsalamon
Copy link

Hey Dima,

Just wanted to let you know I had the same problem (fatal error: 'numpy/ndarrayobject.h' file not found) and it was indeed solved by installing numpy via homebrew. It might be worth adding a comment on this in the installation instructions, since 10.9 is the first version (I think) of OSX that comes with python, numpy & scipy preinstalled, meaning there's a good chance people running 10.9 will run into the same problem in the future.

@dbogdanov
Copy link
Member

Hi, Salamon,

did you first try
pip install numpy
as suggested in the installation instructions and it didn't work on your 10.9?

@dbogdanov dbogdanov reopened this Dec 30, 2013
@justinsalamon
Copy link

the point is I skipped that step of the instructions because 10.9 already comes with python, numpy, scipy, etc. installed. I don't remember if I tried pip install (if I did then it didn't work), sorry! But to summarize - it only worked after installing numpy again using homebrew explicitly.

It's not su much a bug as a matter of adding a clarification in the instructions - I think most people with 10.9 will skip the numpy installation step because they will already have it installed, and then run into the same problem...

@wackou
Copy link
Contributor

wackou commented Dec 30, 2013

Not to bash on them, but you should not use the python executable or anything that comes by default on mac, as they are usually outdated (not yet for mavericks, of course) and will cause compilation problems, as every version of python is compiled with different flags/settings. You should get everything from the same source usually, so either:

  • homebrew (recommended, as this also gives you a huge selection of other packages)
  • macports, fink, ... (not recommended, use homebrew)
  • special scientific python environments (anaconda, EPD, etc.) not tested but they should work fine if you limit yourself to the packages they provide

@justinsalamon
Copy link

sound advice 👍

To avoid issues like this being opened in the future, since mavericks is the first version of OSX that comes with python stuff out of the box, it might make sense to include a line in the instructions recommending to install everything from scratch using homebrew to avoid compilation errors, and noting that for some packages (e.g. numpy) it's not just a recommendation, it's necessary.

Anyway, I leave it to your discretion :) Issue can be closed...

@dbogdanov
Copy link
Member

i did that a couple of hours ago ;)

@hector
Copy link
Contributor

hector commented Dec 30, 2013

As I pointed in a previous issue, pip cannot install correctly libraries in OSX 10.8 and up. To be exact, matplotlib fails on OSX 10.8 and numpy in 10.9. It is a better practice to use only pip for python packages when possible (e.g. to manage virtual envs smoothly) but, in this case, I'd rather advice OSX users with version 10.8 and up (or even OSX version...) to install numpy, scipy and matplotlib with homebrew. By the way, it might be interesting to point out in the instructions that 'brew tap samueljohn/python' is necessary.

@wackou
Copy link
Contributor

wackou commented Dec 31, 2013

I just successfully did the following on OSX 10.9.1:

mkvirtualenv --no-site-packages testnumpy
pip install numpy
pip install matplotlib

In any case, if you want to install numpy/matplotlib with homebrew, and you did install python with homebrew, I don't see any problems with this way of doing it. The nice thing you get with pip is you can install stuff inside a virtualenv (very recommended, get virtualenvwrapper also, once you get used to it it'll feel impossible to get back! ;-) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants