Essentia: ImportError: cannot import name _essentia

Created on 30 Dec 2017  路  11Comments  路  Source: MTG/essentia

Python 3. install options: --mode=release --build-static --with-python --with-vamp
sys.path:
['/home/dm/projects/unsu', '/home/dm/projects/unsu', '/usr/local/lib/python3.5/site-packages', '/usr/local/lib/python3.6/site-packages', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/dm/.local/lib/python3.6/site-packages', '/usr/lib/python3.6/site-packages', '/usr/lib/python3.6/site-packages/lightgbm-0.1-py3.6.egg']
Traceback (most recent call last): File "1_filter_audio.py", line 8, in <module> import essentia File "/usr/local/lib/python3.6/site-packages/essentia/__init__.py", line 1, in <module> from . import _essentia ImportError: cannot import name _essentia
What's wrong?

Most helpful comment

Solved by manually renaming _essentia.cpython-38-darwin.so to _essentia.so.
Inspired by answers in #436.

All 11 comments

it's quite intresting. If I via python interpreter execute import essentia it's ok.

Make sure you have essentia package folder installed in the correct dist-packages folder for your python. How do you execute 1_filter_audio.py?

I reinstalled system. And now I get another error after installation:
`~/.../projects/unsu >>> python [1]
Python 3.6.4 (default, Dec 23 2017, 19:07:07)
[GCC 7.2.1 20171128] on linux
Type "help", "copyright", "credits" or "license" for more information.

import essentia
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'essentia'
import sys
sys.path
['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/lib/python3.6/site-packages']
`

Essentia install in by default install /usr/local/lib/python3.6/site-packages/essentia/weka/wekafile.py (from src/python/essentia/weka/wekafile.py)
I fix it with export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/site-packages in .bashrc/.zshrc

So it looks like you need to install in another folder for ArchLinux

It's common that when installing from source, the packages go to /usr/local/lib instead of /usr/lib, so you might make sure both paths are seen by Python.

I am also having this issue of, having just recently installed Essentia via homebrew with Python 3.8 on to OSX Catalina 10.15.3 via:

$ brew tap MTG/essentia
$ brew install essentia --HEAD

It is installed to /usr/local/lib/python3.8/site-packages/essentia/ and I've added:

export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.6/site-packages

as well as

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

to my ~/.bash-profile, the latter per the Essentia documentation instructions. I get the same errors in a normal python3 environment as well as in an iPython/jupyter environment. I am using conda.

Any updates? Thanks!

I also have the same error

Hi,
I'm facing the same issue, MacOs Catalina, python 3.8.3. Does anyone succeeded ?

Same error as the original one reported by @SaturnTeam :
from . import _essentia ImportError: cannot import name _essentia
Working on osx 10.15.2. Brew installs essentia at the same location reported by @camillenoufi.
Setting the export paths in the bash did not work, neither a manual copy into the correct python version folder (/usr/local/lib/python3.7).
Does the _essentia name on the import references the _essentia.cpython-38-darwin.so file?

Solved by manually renaming _essentia.cpython-38-darwin.so to _essentia.so.
Inspired by answers in #436.

@andresperezlopez This worked for me, solved the frustration of a whole afternoon trying to install the package! Thanks!

@andresperezlopez @nicodaleman in my case it worked by creating a single simlink.
ln -s /Volumes/storessd/brew/Cellar/essentia/HEAD-358a75f/lib/python3.8/site-packages/essentia/_essentia.cpython-38-darwin.so /usr/local/lib/python3.8/site-packages/essentia/_essentia.so

I think renaming dynamic libraries is not a good practice. and even if you create this link, it's not 100% sure that will work in a virtual or conda environment, since the packages need to be the same as the ones in the original python site_packages

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexsivris picture alexsivris  路  3Comments

aagnone3 picture aagnone3  路  3Comments

techiespace picture techiespace  路  4Comments

fnbns picture fnbns  路  9Comments

Tripphippie picture Tripphippie  路  56Comments