MTG/essentia

Python instalation Segmentation Fault

Closed this issue · 9 comments

fnbns commented

Dear essentia users,

I mananged to install essentia through brew. I have anaconda installed also and I ran the following commands:

  1. mkdir -p /Users/atnm1/.local/lib/python2.7/site-packages
  2. echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/atnm1/.local/lib/python2.7/site-packages/homebrew.pth

However, when I import essentia I get:

Segmentation fault 11

Can you help me with this?
Thank you,
Alex.

Have you resolved this problem?

fnbns commented

No, I've tried several environments (os Siera & OSX Capitan) but I get the same error.

I use Miniconda 3.5 on Mac OS X Sierra, and this is how I do it:

Install Essentia via Homebrew
brew tap MTG/essentia
brew install essentia

Move Essentia package from Homebrew to your Conda virtual environment
cp -r /usr/local/lib/python2.7/site-packages/essentia ~/miniconda/envs/my_project_env/lib/python2.7/site-packages/essentia

Would be nice to be able to install the python bindings directly via pip though!

I'm trying to fix these kind of problems in #597.

I did solve the segmentation fault on mac os x 10.12. by: 1) adding the path of @jpauwels, then 2) compiled using the python installed with homebrew with the flag --python= like that:

/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/bin/python ./waf configure --with-python --python=/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/bin/python --include-algos=MFCC --arch=x64
/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/bin/python ./waf
/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/bin/python ./waf install

When I run on the installed python extension
otool -L /usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/essentia/_essentia.so
...the first lines are:

/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.8.0)
	/Users/joro/workspace/essentia/build/src/libessentia.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)

...this last line shows that it is being linked against the system's python (as far as I understand), not the one from brew.

Then importing essentia gives:


/usr/local/Cellar/python/2.7.8/Frameworks/Python.framework/Versions/2.7/bin/python
Python 2.7.8 (default, Jul  2 2014, 10:14:46)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import essentia
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/essentia/__init__.py", line 1, in <module>
    from . import _essentia
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/essentia/_essentia.so, 2): Symbol not found: __ZN8essentia9streaming7connectERNS0_10SourceBaseERNS0_15FileOutputProxyE
  Referenced from: /usr/local/lib/python2.7/site-packages/essentia/_essentia.so
  Expected in: flat namespace
 in /usr/local/lib/python2.7/site-packages/essentia/_essentia.so

Any idea?

@georgid Include FileOutputProxy to your list of algorithms to include (the --include-algos flag)

Thanks @dbogdanov, that solved my particular problem.
Further, I realized the right way to avoid the segmentation fault is to explicitly tell essentia which python version to use with the -python flag

@dbogdanov you can close the issue. Thanks for your help

Have had Segmentation Fault problem with "import essentia" on macOS 10.13 and pyenv.
#597 patch didn't help. It appears, that my python installation has no "Framework".

After reinstalling python with:
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.5.1
(and then recompiling/reinstalling essentia)
everything works!