I am given ModuleNotFoundError when I try to import libraries. I am on Mac Big Sur 11.6.1
Asked
Active
Viewed 77 times
0
-
2Install numpy by running `pip install numpy` – dhilmathy Jan 08 '22 at 02:14
-
Likely a duplicate of https://stackoverflow.com/questions/7818811/import-error-no-module-named-numpy – Dennis Jan 08 '22 at 02:17
-
it says "Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (1.21.5)" – James Jan 08 '22 at 02:17
-
You are using Python 3.8.9, not 3.9 – John Stud Jan 08 '22 at 02:20
-
Your screenshot shows your VS Code is using a "Python 3.8.9" environment, and your comment about numpy "already satisfied" is from a "Python 3.9" environment. You have to make sure the Python where you installed numpy is the same Python you use to run jupyter. – Gino Mempin Jan 08 '22 at 02:21
-
I'm voting to close as a duplicate of [How do you get Visual Studio Code to use different Python interpreter?](https://stackoverflow.com/questions/58470563/how-do-you-get-visual-studio-code-to-use-different-python-interpreter) because the root issue is that you need to use the correct Python env. – Gino Mempin Jan 08 '22 at 02:23
-
I changed to Python 3.9.6 64-bit still shows the error.. – James Jan 08 '22 at 02:26
-
Does it show "Python 3.9.6 64-bit" on the top right corner, same as your screenshot? Is that the same Python env where you installed numpy? – Gino Mempin Jan 08 '22 at 02:29
-
I added another pic showing that I have changed the environment but the issue is not solved – James Jan 08 '22 at 02:30
-
1From the screenshot of your terminal, it seems you are using the Code Runner extension. You need to tell Code Runner to _also use the same Python interpreter_. See: https://stackoverflow.com/q/19797616/2745495, https://stackoverflow.com/q/57541747/2745495 – Gino Mempin Jan 08 '22 at 02:33
-
1an alternative way is to run `pip list` and it will tell if libraries are installed. If not either you install the libraries ; or through `Python: Select Interpreter` ( `CTRL-SHIFT-P` ( `SHFT-OPTION-P` mac) and select the correct environment. – simpleApp Jan 08 '22 at 03:08
1 Answers
0
After you switch to the 3.9.6
version of Python, it can find the numpy
package.
So you need to install the rest of the packages: matplotlib
and so on.
Ctrl+Shif+P -> Python: Select Interpreter -> Ctrl+Shift+` -> in the terminal execute pip install matplotlib

Steven-MSFT
- 7,438
- 1
- 5
- 13