If you are trying to run a notebook in Terminal and you get an error "No module named notebook", you are missing the jupyter module.
% python3 -m notebook
/Library/Developer/CommandLineTools/usr/bin/python3: No module named notebook
Fix: No module named notebook error
Solution 1:- Open Terminal (or Command Line)
- Run the following command to install to install jupyter
pip3 install jupyter
- Now you should be able to run the notebook
Do check which pip3 and python3 binaries are in use, it could be that there is a mismatch
% which pip3
/opt/homebrew/bin/pip3
% which python3
/usr/bin/python3
As you may see using the which command, we have pip3 from homebrew package and python3 form usr/bin.
Make sure to install jupyter package using brew command.
brew install jupyter
Setting an alias in .zshrc or .bashprofile would help to fix this issue.
alias python3.10="/opt/homebrew/bin/python3.10"
% python3 -m notebook
[I 11:43:06.459 NotebookApp] Writing notebook server cookie secret to /Users/code2care/Library/Jupyter/runtime/notebook_cookie_secret
_ _ _ _
| | | |_ __ __| |__ _| |_ ___
| |_| | '_ \/ _` / _` | _/ -_)
\___/| .__/\__,_\__,_|\__\___|
|_|
Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.
https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html
Please note that updating to Notebook 7 might break some of your extensions.
[I 11:43:06.649 NotebookApp] Serving notebooks from local directory: /opt/homebrew/bin
[I 11:43:06.649 NotebookApp] Jupyter Notebook 6.5.3 is running at:
[I 11:43:06.649 NotebookApp] http://localhost:8888/?token=028705476147dd17b34a1f0699eda8efb5dc9184a16a0f77
[I 11:43:06.649 NotebookApp] or http://127.0.0.1:8888/?token=028705476147dd17b34a1f0699eda8efb5dc9184a16a0f77
[I 11:43:06.649 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
To access the notebook, open this file in a browser:
file:///Users/code2care/Library/Jupyter/runtime/nbserver-6362-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=028705476147dd17b34a1f0699eda8efb5dc9184a16a0f77
or http://127.0.0.1:8888/?token=028705476147dd17b34a1f0699eda8efb5dc9184a16a0f77
[W 11:43:08.224 NotebookApp] 404 GET /apple-touch-icon-precomposed.png (::1) 15.820000ms referer=None
[W 11:43:08.232 NotebookApp] 404 GET /apple-touch-icon.png (::1) 2.090000ms referer=None
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- How to convert int to ASCII in Python
- How to make use of SQLite Module in Python?
- Split a String into Sub-string and Parse in Python
- Python: Pandas Rename Columns with List Example
- How to run Python file from Mac Terminal
- How to Exit a Loop in Python Code
- Python: How to Plot a Histogram using Matplotlib and data as list
- MD5 Hashing in Python
- Jupyter: Safari Cant Connect to the Server localhost:8888/tree
- Fix: AttributeError: str object has no attribute decode. Did you mean: encode?[Python]
- How to Read a binary File with Python
- How to add two float numbers in Python
- Python: How to install YAML Package
- Python: How to Save Image from URL
- What is Markdown in Jupyter Notebook with Examples
- How to change the Python Default version
- 33: Python Program to send an email vid GMail
- How to comment code in Python
- How to Fix AttributeError in Python
- Fix: error: Jupyter command `jupyter-nbconvert` not found [VSCode]
- How to comment out a block of code in Python
- List of All 35 Reserved Keywords in Python Programming Language 3.11
- Import Other Python Files Examples
- Python: How to add Progress Bar in Console with Examples
- 3 Ways to convert bytes to String in Python
- How to find AUTO_INCREMENT Fields value in MySQL table - MySQL
- Python POpen Subprocess Examples - Python
- [Eclipse] Locate Preferences in macOS - MacOS
- [jQuery] Uncaught ReferenceError: $ is not defined at index.html:5 - jQuery
- Install OpenSSL on Linux/Ubuntu - Linux
- Pure JavaScript Digital Clock Widget to get GMT/UTC Time Now - JavaScript
- Comprehensive 256 Ascii code table with Html Hex IBM Microsoft Key - Html
- Youtube spacebar not working in search on macOS Safari - MacOS