ModuleNotFoundError: No module named 'librosa'

Viewed 20441

Currently I am working on voice recognition where I wanted to use Librosa library.

I install librosa with the command on ubuntu:

conda install -c conda-forge librosa

But when I run the code I got the following error:

import librosa


  

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-9-989066361697> in <module>
----> 1 import librosa

ModuleNotFoundError: No module named 'librosa'

Can anyone tell me how to use librosa?

5 Answers

If you’re using a Python 3.5 environment in conda, you may run into trouble with the numba dependency. This can be avoided by installing from the numba conda channel before installing librosa:

Run this command first in anaconda prompt

conda install -c numba numba

and then

conda install -c conda-forge librosa

I hope this would help you

There are two solutions,

  1. Try to install librosa by system:

*. First open cmd in system and try one of following commands.

pip install librosa

sudo pip install librosa

pip install -u librosa

  1. Or in conda environment:

*. Open appropriate anaconda prompt(according to environment) and try following commands inorder,

First, conda install -c numba numba

Then, conda install -c conda-forge librosa

What I did

I had a similar problem. I had to use the following code:

sys.path.append(r"C:{pathtopython}\Lib\site-packages")

Assuming you downloaded librosa to the path above, then the program will be able to find librosa and use it.

Why it Works/Why it Happened

It works because the program is looking in a directory that the package isn't in.

All my other packages were able to be found by my program without using the code above, so I think it's related to the librosa installation.

Do pip install librosa --user and then restart Anaconda.

It did not work for me also and I received the same error. Then I cut and pasted the entire code to a new SPYDER document and it worked. Not sure why it did not work the first time in SPYDER. But try pasting into a new SPYDER file and see what happens.

Related