Search code examples
python-3.xvisual-studio-codepipjupyter-notebook

Modules installed globally not found in VS Code Jupyter Notebook


I've installed several Python modules from PyPi globally on Mac OS using pip3. Running pip3 list confirms that they are installed:

user@users-MacBook-Pro SER-neural-net % pip3 list
Package            Version
------------------ ---------
appdirs            1.4.4
audioread          3.0.0
...
librosa            0.9.2
numpy              1.23.4
pip                22.3.1
scikit-learn       1.1.3
scipy              1.9.3
sklearn            0.0.post1
sounddevice        0.4.5
soundfile          0.11.0
torch              1.13.0
...

From the integrated terminal in VS Code where I am running the notebook, I have run the following commands to determine which Python interpreter to use:

user@users-MacBook-Pro SER-neural-net % which pip3
/usr/local/bin/pip3
user@users-MacBook-Pro SER-neural-net % which python3
/usr/local/bin/python3
user@users-MacBook-Pro SER-neural-net % python3 --version
Python 3.7.9

I have selected the appropriate interpreter at the top right of Jupyter Notebook view in VS Code: currently selected interpreter

But the modules confirmed to be installed for this interpreter are not found: enter image description here

What has gone wrong?


Solution

  • use this: python3 -m pip install --user (library)

    for example: python3 -m pip install --user pandas