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!
- Python List of Lists with Examples
- Fix: ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none) ERROR: No matching distribution found for tkinter
- How to Convert Python Notebook .ipynb (JSON) to Executable .py Module
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python]
- Python: Pandas Merge Indicator (Left, Right and Both) Example
- Fix: EOFError Exception in Python
- How to URL Decode a Query String in Python
- How to take user input from the console in a Python program
- Compare two lists in Python and return matches
- How to change the Python Default version
- Fix: KeyError: exception in Python
- How to get the Execution Time of A Python Program
- Fix: ModuleNotFoundError: No module named boto3 [Python]
- How to get unique values from a list in Python
- How to pip install Python Modules in VSCode
- Python: Fix - TypeError: NoneType object is not iterable
- How to delete a file using Python code example
- How to create a dictionary comprehension in Python
- Python: Get just the filename without extension using Path
- How to comment out a block of code in Python
- How to add two float numbers in Python
- Python: How to POST Json Data with HTTP Request
- Get MD5 Hash as Checksum of a String in Python
- Python - Convert float to String
- How to Parse XML String in Python
- [fix] Java NullPointerException ComparableTimSort countRunAndMakeAscending when sorting a List - Java
- Fix: SpringFramework BeanDefinitionValidationException: Could not find an init method named - Java
- Program 37: Store your name in a variable and print it - Python-Programs
- How to do screen recording on Mac - MacOS
- How to switch between sftp and Terminal shell - FTP
- How to reload zsh shell profile file? - zsh
- Add days/weeks/months/years to LocalDate in Java 8 and above examples - Java
- ls command to list only directories - Linux