Sahar
Sahar

Reputation: 45

ModuleNotFoundError on Librosa even after following all the steps on the internet

Error showing up

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-5-55d8c0d02ff9> in <module>
      3 import os
      4 import pandas as pd
----> 5 import librosa
      6 import glob
      7 import librosa.display

ModuleNotFoundError: No module named 'librosa'

I tried pip install librosa and conda install -c conda-forge librosa.
I tried installing it in the C:\Program Files\Python39 directory. I tired all of the steps to do on the internet but nothing worked.

What should I do? Please help me out

Upvotes: 0

Views: 1269

Answers (1)

Could you please check what is the python version that you're using for installing librosa and what python version you're using to run the program.

One better way is to check from the python interpreter.

As a rule of thumb, best way to manipulate packages is by creating a virtualenv and segregating the project dependencies.

To create a virtual environment and link it to Jupyter notebook , below steps would be helpful

  1. create a virtualenv

    virtualenv venv
    
  2. activate virtualenv and install ipykernel

    source venv/bin/activate
    pip install --user ipykernel
    
  3. add virtualenv to Jupyter notebook

    python -m ipykernel install --user --name=venv
    Installed kernelspec venv in /home/user/.local/share/jupyter/kernels/venv
    
  4. Now you can Jupyter notebook and virtualenv will be linked in the notebook. you can install modules in the virtualenv and can use it in the notebook.

more details here

Upvotes: 1

Related Questions