Issue
I am trying to use a Python module called Essentia which is used for audio analysis. In order to use that, it has to be built in Ubuntu Environment as explained here. I did all the things to install Essentia
in a folder in desktop.
Then in IPython
, I am trying to import the installed and built Essentia
module. I am running IPython
in the folder where my module is located. It is not in /usr/lib/python2.7
. It is located in my desktop as mentioned above.
But when I import Essentia module in IPython, it tells me
ImportError: No module named essentia
What is the problem here? Do I have to build Essentia inside /usr/lib/python2.7
, and if so, how do I do that? Or has some other thing gone wrong?
Solution
I had the exact same problem and was able to fix it.
From your question I can't be 100% sure what your problem is - however, these are a couple of possible culprits which you - or others - may be having.
I, too, am using Python 2.7, and want to use Essentia in an IPython/Jupyter Notebook environment.
1. Essentia location
This is my first guess as to what your problem is.
If you were able to successfully configure and install Essentia (otherwise see below), the path where the Essentia Python files were likely installed is /usr/local/lib/python2.7/site-packages
or similar, and that Python isn't looking there. To make sure it does, you could add
import sys
sys.path.append("/usr/local/lib/python2.7/site-packages")
to the start of your Python script.
This solved it for me.
You could also add the following line to your ~/.bash_profile
:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages/
to avoid having to add this path to every Python file/Notebook where you would like to use Essentia.
2. Configuration and installation
Skip this if you were able to successfully configure and install Essentia. These were other notable issues I had before I finally got the install finished successfully
message.
The main instructions, as OP noted, are here.
ffftw3f or taglib not found
I resolved this using MacPorts instead:
sudo port install fftw-3-single
sudo port install taglib
Failed installation
I should note I had some issues during installation which made me get rid of the C++ tests, Gaia, and Vamp plugin support (none of which I needed) by removing these and some others from the config line (as this has helped other users in the past):
./waf configure --mode=release --with-python --with-examples
instead of
./waf configure --mode=release --build-static --with-python --with-cpptests --with-examples --with-vamp --with-gaia
This made the following error message go away:
Build failed
-> task in 'standard_fadedetection' failed (exit status 1):
{task 4417706448: cxxprogram standard_fadedetection.cpp.5.o -> standard_fadedetection}
['clang++', '-stdlib=libc++', 'src/examples/standard_fadedetection.cpp.5.o', '-o', '/Users/Brecht/Downloads/essentia-2.0.1/build/src/examples/standard_fadedetection', '-Lsrc', '-lessentia', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-lfftw3f', '-lyaml', '-lavformat', '-lavcodec', '-lavutil', '-lswresample', '-lsamplerate', '-ltag']
-> task in 'streaming_extractor_freesound' failed (exit status 1):
{task 4417783952: cxxprogram FreesoundExtractor.cpp.22.o,FreesoundLowlevelDescriptors.cpp.22.o,FreesoundRhythmDescriptors.cpp.22.o,FreesoundSfxDescriptors.cpp.22.o,FreesoundTonalDescriptors.cpp.22.o,streaming_extractor_freesound.cpp.22.o -> streaming_extractor_freesound}
['clang++', '-stdlib=libc++', 'src/examples/freesound/FreesoundExtractor.cpp.22.o', 'src/examples/freesound/FreesoundLowlevelDescriptors.cpp.22.o', 'src/examples/freesound/FreesoundRhythmDescriptors.cpp.22.o', 'src/examples/freesound/FreesoundSfxDescriptors.cpp.22.o', 'src/examples/freesound/FreesoundTonalDescriptors.cpp.22.o', 'src/examples/streaming_extractor_freesound.cpp.22.o', '-o', '/Users/Brecht/Downloads/essentia-2.0.1/build/src/examples/streaming_extractor_freesound', '-Lsrc', '-lessentia', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-L/opt/local/lib', '-lfftw3f', '-lyaml', '-lavformat', '-lavcodec', '-lavutil', '-lswresample', '-lsamplerate', '-ltag']
Let me know how that works out - I've got a feeling I've had about all the errors you could encounter.
(Acknowledgement: The main reason I was able to solve this so quickly is this thread - also thanks to @djmoffat and @justin_salamon.)
Answered By - BrechtDeMan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.