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 errorSolution 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.
% 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.
Have Questions? Post them here!
More Posts related to Python,
- Check version of pip package installer for Python
- How to install Python 3.9 using brew on Mac
- Python Program To Calculate Simple Interest (SimpleInterest.py)
- Indent Python code in Notepad++
- Change label (text) color in tkinter
- Float built-in function in Python
- [Fix] ValueError: substring not found in Python
- pip get list of all outdated Python packages
- Calculate discount amount python code
- 3 Python program to add two numbers
- How to List all Packages installed using pip [Python]
- Python range() function examples
- How to resolve Failed to create interpreter PyCharm Error
- Format Python Code in Visual Studio Code (VS Code)
- Validate email address in Python using regular expression (regex)
- Install and Run Jupyter Notebook on Mac (macOS)
- How to delete a file using Python code example
- Base64 Encoding Decoding in Python Programming
- How to pip install Python Modules in VSCode
- Change the background of Tkinter label or text
- Comments in Python Programming
- Take input argument from command line in Python Programming
- How to Convert Python String to DateTime Object
- Tkinter - add x and y padding to label text
- [Tutorial] Install Python on Visual Studio Code (VS Code)
- How to Add Padding to Android TextView - Android
- Failed to sync Gradle project Error:failed to find target android-23 - Android
- How to check Command Line Tools Version [Updated for Ventura] - MacOS
- Error code 0xCAA82EE2: Something went wrong (request timed out) [Microsoft] - Microsoft
- Installing Native Chrome Browser App on M1 Mac Device - Chrome
- How to convert byte array to String [Kotlin] - HowTos
- Replace tabs by spaces or comma Notepad++ - NotepadPlusPlus
- Release Date and iPhone Devices that will Support iOS 16 - iOS