python-jsonschema / jsonschema

An implementation of the JSON Schema specification for Python
https://python-jsonschema.readthedocs.io
MIT License
4.58k stars 578 forks source link

Draft7Validator(TyperError: create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry' #1207

Closed gokceneraslan closed 8 months ago

gokceneraslan commented 8 months ago

jupyter users are getting this error and it's fixed when jsonschema is downgraded from 4.20.0 to 4.19.2. There is already an issue on the jupyter side (https://github.com/jupyter/jupyter_core/issues/369)

Full exception:

❯ jupyter --version
Selected Jupyter core packages...
IPython          : 8.16.0
ipykernel        : 6.25.2
ipywidgets       : not installed
jupyter_client   : 8.4.0
jupyter_core     : 5.4.0
jupyter_server   : 2.8.0
Traceback (most recent call last):
  File "/usr/bin/jupyter", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/jupyter_core/command.py", line 261, in main
    mod = __import__(package)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/jupyterlab/__init__.py", line 8, in <module>
    from .handlers.announcements import (
  File "/usr/lib/python3.11/site-packages/jupyterlab/handlers/announcements.py", line 14, in <module>
    from jupyter_server.base.handlers import APIHandler
  File "/usr/lib/python3.11/site-packages/jupyter_server/base/handlers.py", line 24, in <module>
    from jupyter_events import EventLogger
  File "/usr/lib/python3.11/site-packages/jupyter_events/__init__.py", line 3, in <module>
    from .logger import EVENTS_METADATA_VERSION, EventLogger
  File "/usr/lib/python3.11/site-packages/jupyter_events/logger.py", line 19, in <module>
    from .schema import SchemaType
  File "/usr/lib/python3.11/site-packages/jupyter_events/schema.py", line 18, in <module>
    from .validators import draft7_format_checker, validate_schema
  File "/usr/lib/python3.11/site-packages/jupyter_events/validators.py", line 44, in <module>
    JUPYTER_EVENTS_SCHEMA_VALIDATOR = Draft7Validator(
                                      ^^^^^^^^^^^^^^^^
TypeError: create.<locals>.Validator.__init__() got an unexpected keyword argument 'registry'
Julian commented 8 months ago

Hi, sorry you're having trouble. Please don't crosspost unless you think there's an issue here with this package -- and if/once you do, please share a minimal reproducer which reproduces the issue and with no additional dependencies installed. I'll be happy to try to help on the Jupyter issue, but the most likely initial diagnosis is (frankly but politely) user error with installing dependencies, so let's do that on the Jupyter issue.

gokceneraslan commented 8 months ago

Apologies, thanks!

samrajput1143 commented 3 months ago

it also worked for me