ImportError with encodestring from package base64
- Dominant language
- Python
- Stars
- 313
- Forks
- 176
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Jupyter experiences a fatal error on startup. ImportError: cannot import name 'encodestring' from 'base64' (/usr/lib/python3.9/base64.py). 'encodestring is a removed function in python 3.9.
Apparently this error is caused by nbformat importing base64
**To Reproduce**
Steps to reproduce the behavior:
1. Python version 3.9
2. Run any Jupyter product (Notebook, lab).
**Expected behavior**
Traceback (most recent call last):
File "/home/user/.local/bin/jupyter-notebook", line 5, in
from notebook.notebookapp import main
File "/home/user/.local/lib/python3.9/site-packages/notebook/notebookapp.py", line 83, in
from .services.contents.manager import ContentsManager
File "/home/user/.local/lib/python3.9/site-packages/notebook/services/contents/manager.py", line 17, in
from nbformat import sign, validate as validate_nb, ValidationError
File "/home/user/.local/lib/python3.9/site-packages/nbformat/init.py", line 14, in
from . import v1
File "/home/user/.local/lib/python3.9/site-packages/nbformat/v1/init.py", line 19, in
from .nbjson import reads as reads_json, writes as writes_json
File "/home/user/.local/lib/python3.9/site-packages/nbformat/v1/nbjson.py", line 19, in
from base64 import encodestring
ImportError: cannot import name 'encodestring' from 'base64' (/usr/lib/python3.9/base64.py)
**Desktop (please complete the following information):**
* OS: Manjaro 20.12.2 Gnome 3.38.4
* Browser Firefox 86.0.01-01
* Jupyter 4.4.0
Contributor guide
Research direction
Start with nbformat/v1/nbjson.py, where the traceback shows the failing import, and compare it with Python 3.9's base64 API. Reproduce the startup failure using Python 3.9 and a Jupyter product; done means nbformat no longer raises this ImportError during startup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter, python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100