Skip to content

Instantly share code, notes, and snippets.

@jarmitage
Created February 26, 2019 15:29
Show Gist options
  • Select an option

  • Save jarmitage/40e3b7962b0a77a233b2d590d69378d6 to your computer and use it in GitHub Desktop.

Select an option

Save jarmitage/40e3b7962b0a77a233b2d590d69378d6 to your computer and use it in GitHub Desktop.
How to install Essentia on macOS using an Anaconda environment

How to install Essentia on macOS using an Anaconda environment

[This is a brief note so I don't forget how to do this, and will probably be technically obsolete before long!]

Essentia is an "Open-source library and tools for audio and music analysis, description and synthesis" (https://essentia.upf.edu)

If you use Jupyter Lab / notebooks and therefore manage your Python environments using Anaconda, AND your machine is macOS, you will not be able to install Essentia out of the box. This is because:

If you try to install Essentia from source (https://essentia.upf.edu/documentation/installing.html) using an Anaconda environment on macOS, you will find that a bug in CPython means that ./waf configure [...] fails:

However:

  1. homebrew's Python does not suffer from the same issue
  2. The issue above is only relevant in the configure step and not the install steps.

So! A hacky, ugly, probably broken somewhere/somehow workaround, is:

  • Do ./waf configure [...] using Python installed via homebrew (brew install python) rather than Anaconda
  • Then complete the rest of the installation using Anaconda's Python

Your essentia installation may end up in /usr/local/lib/python3.7/site-packages/, so you then need to add this to your Anaconda path:

import sys
sys.path.append('/usr/local/lib/python3.7/site-packages/') # not permanent

Now you should be able to import essentia from your Anaconda environment.

Yes, I did say it's ugly.

@BenjaminOlsen
Copy link

BenjaminOlsen commented Dec 3, 2022

I had trouble with the ffmpeg libraries (libavcodec, libavformat, etc) installed via brew or ports, so i downloaded the ffmpeg 4.1 source directly from: https://git.ffmpeg.org/gitweb/ffmpeg.git/shortlog/refs/heads/release/4.1, (the most recent snapshot, commit a8a208b), then configured and build ffmpeg with shared libraries:

cd ffmpeg-a8a208b
./configure --enable-shared    
make    
make install

Then following francesco's steps above worked

Edit: I am on osx 10.15.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment