Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Databases and Redis

Jupyter will not start: Validator got an unexpected keyword argument 'registry'

Your error

TypeError: create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry'2 more lines it can show

Fix it fast

Most common cause, 1 of 2

Another package pinned jsonschema below 4.18 and pip downgraded it

Upgrade jsonschema back to a current release in that environment.

Fix
python -m pip install -U "jsonschema[format-nongpl]>=4.18"
python -m pip check
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

The TypeError create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry' means jupyter_events passed registry= to a jsonschema older than 4.18, the release that added the referencing library. Either a package downgraded jsonschema, or an old copy in the user site-packages shadows the environment's. Upgrade or remove that copy. Applies to jupyter-events 0.12 and jsonschema 4.26.

  • Applies to jupyter-events 0.12.1, jsonschema 4.26.0, JupyterLab 4.6.6, Notebook 7.6.5
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Use the same Python that runs Jupyter and ask two questions: which jsonschema version pip thinks is installed, and which file Python really imports. An old version in the environment is cause 1. A new version in the environment but an import path under ~/.local is cause 2.

Run this first
python -m pip show jsonschema | grep -E "^(Version|Location)"
python -c "import jsonschema; print(jsonschema.__file__)"

Then find the line you see in this list and open its fix:

  1. 1Another package pinned jsonschema below 4.18 and pip downgraded itpip show prints Version: 4.17.x, and pip check names jupyter-events with a line ending in but you have jsonschema 4.17.x
  2. 2An old jsonschema in the user site-packages shadows the new onepip show in the environment reports 4.18 or later, yet jsonschema.__file__ points into ~/.local/lib/pythonX.Y/site-packages

What does the error look like?

  • TypeError: create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry'
  • File ".../site-packages/jupyter_events/validators.py", line 46, in <module>
  • JUPYTER_EVENTS_SCHEMA_VALIDATOR = Draft7Validator(

Cause 1 of 2

Another package pinned jsonschema below 4.18 and pip downgraded it

You seepip show prints Version: 4.17.x, and pip check names jupyter-events with a line ending in but you have jsonschema 4.17.x

Check

The unexpected keyword 'registry' error appears when jsonschema is older than 4.18, while jupyter-events declares jsonschema[format-nongpl]>=4.18.0 and builds its Draft7Validator with registry=. Installing a library that pins jsonschema below 4.18 into the same environment downgrades it, and Jupyter breaks on the next start.

Check
python -m pip check

Fix

Upgrade jsonschema back to a current release in that environment. Install the package that needs the old pin into its own virtual environment instead of the Jupyter one, or upgrade it to a release that accepts newer jsonschema.

Fix
python -m pip install -U "jsonschema[format-nongpl]>=4.18"
python -m pip check

Verify

pip check prints No broken requirements found, and Jupyter starts and prints its version.

Verify
jupyter lab --version

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 2

An old jsonschema in the user site-packages shadows the new one

You seepip show in the environment reports 4.18 or later, yet jsonschema.__file__ points into ~/.local/lib/pythonX.Y/site-packages

Check

Even a fresh conda environment can still raise the registry TypeError when an old pip install --user copy exists. PEP 370 places the user site directory before the system site directories on sys.path, so that copy wins. A venv that does not include system site packages skips the user folder.

Check
python -m site --user-site

Fix

Confirm by starting Jupyter with the user folder switched off. If it starts, delete the old jsonschema folders from the path that python -m site --user-site printed, or keep PYTHONNOUSERSITE=1 set for that environment.

Fix
ls "$(python -m site --user-site)" | grep -i -E "jsonschema|referencing"
PYTHONNOUSERSITE=1 jupyter lab

Verify

jsonschema.__file__ now points inside the environment's own site-packages, and Jupyter starts without the TypeError.

Verify
python -c "import jsonschema; print(jsonschema.__file__)"

Confirmed by peps.python.org

Did this fix it?

How do I stop it coming back?

  • Give Jupyter its own virtual environment and install project libraries with strict old pins elsewhere.
  • Run python -m pip check after every pip install in a Jupyter environment, and fail CI images on its exit code.
  • Avoid pip install --user on machines that also use conda or system Python for Jupyter.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.