Open jclsn opened 9 months ago
Getting the same issue here - did you manage to figure out the cause?
Versions for mine (in case it helps triangulate):
(.venv) jupyter --version
Selected Jupyter core packages...
IPython : 8.18.1
ipykernel : 6.27.1
ipywidgets : 8.1.1
jupyter_client : 8.6.0
jupyter_core : 5.5.0
jupyter_server : 2.12.1
Traceback (most recent call last):
Aha - for me the culprit was apparently an older version of jsonschema that had been pulled in as a dependency by another python module.
I am having the same problem in Ubuntu 20.04 in pipenv and poetry envs as well. Any ideas how to fix it?
jupyter --version
Selected Jupyter core packages...
IPython : 8.18.1
ipykernel : 6.27.1
ipywidgets : 8.1.1
jupyter_client : 8.6.0
jupyter_core : 5.5.1
jupyter_server : 2.12.1
Traceback (most recent call last):
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/bin/jupyter", line 8, in <module>
sys.exit(main())
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/lib/python3.10/site-packages/jupyter_core/command.py", line 260, in main
mod = __import__(package)
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/lib/python3.10/site-packages/jupyterlab/__init__.py", line 8, in <module>
from .handlers.announcements import (
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/lib/python3.10/site-packages/jupyterlab/handlers/announcements.py", line 14, in <module>
from jupyter_server.base.handlers import APIHandler
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/lib/python3.10/site-packages/jupyter_server/base/handlers.py", line 23, in <module>
from jupyter_events import EventLogger
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/lib/python3.10/site-packages/jupyter_events/__init__.py", line 3, in <module>
from .logger import EVENTS_METADATA_VERSION, EventLogger
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/lib/python3.10/site-packages/jupyter_events/logger.py", line 19, in <module>
from .schema import SchemaType
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/lib/python3.10/site-packages/jupyter_events/schema.py", line 18, in <module>
from .validators import draft7_format_checker, validate_schema
File "/home/xxx/.var/app/com.jetbrains.PyCharm-Community/data/virtualenvs/pythonProject-SksRS6Wi/lib/python3.10/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'
Downgrading jsonschema
from the latest 4.20.0
to 4.19.2
solved the issue for me, fyi.
@Julian Any suggestions?
How does one reproduce the issue being reported here?
Running jupyter --version
as shown above (or in my case running jupyter-lab
) triggers the error when jsonschema 4.20.0 is installed.
Should this line now also include <4.20.0?
That produces no error here.
⊙ python3.12 -m venv venv && PYTHONWARNINGS=ignore venv/bin/pip install --quiet jupyter && venv/bin/jupyter --version julian@Airm
[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: python3.12 -m pip install --upgrade pip
/Users/julian/Desktop/venv/lib/python3.12/site-packages/jupyter_core/command.py:23: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
given by the platformdirs library. To remove this warning and
see the appropriate new directories, set the environment variable
`JUPYTER_PLATFORM_DIRS=1` and then run `jupyter --paths`.
The use of platformdirs will be the default in `jupyter_core` v6
from . import paths
Selected Jupyter core packages...
IPython : 8.19.0
/Users/julian/Desktop/venv/lib/python3.12/site-packages/dateutil/tz/tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
EPOCH = datetime.datetime.utcfromtimestamp(0)
ipykernel : 6.28.0
ipywidgets : 8.1.1
jupyter_client : 8.6.0
jupyter_core : 5.7.0
jupyter_server : 2.12.1
jupyterlab : 4.0.10
nbclient : 0.9.0
nbconvert : 7.14.0
nbformat : 5.9.2
notebook : 7.0.6
qtconsole : 5.5.1
traitlets : 5.14.1
(and for reference:
⊙ venv/bin/python -m pip show jsonschema julian@Airm
Name: jsonschema
Version: 4.20.0
Summary: An implementation of JSON Schema validation for Python
Home-page:
Author: Julian Berman
Author-email: Julian+jsonschema@GrayVines.com
License: MIT
Location: /Users/julian/Desktop/venv/lib/python3.12/site-packages
Requires: attrs, jsonschema-specifications, referencing, rpds-py
Required-by: jupyter-events, jupyterlab_server, nbformat
Wait, now I updated jsonschema to 4.20.0 and I cannot reproduce the error. I really didn't change anything in between...
how to slove it ?
Hit same error
File "/Users/sophia/.pyenv/versions/3.11.2/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'
I solved it by
pip install --upgrade jupyterlab jupyterlab_server jupyter_server traitlets nbformat
as per this post
@fengs Your answer above solved my issue as well.
I'll just note that running that sort of command is exactly the kind of mistake that's likely to have gotten you into this situation.
Specifically, I claim the only way you could have broken your installation is by running that kind of command!
It's true that running a similar one may get you out of it.
But in Python, it is not safe to run repeated installation commands willy nilly.
pip
will not save you from running pip install
once and then pip install
later in a way that might downgrade a thing you installed. In short: it is a user error if you ever run pip install --upgrade
essentially in my opinion, but you doing it twice may indeed fix something (and perhaps break another!).
@Julian Keep in mind that some of us develop in environments where we only have partial admin rights. Your assumption is incorrect as I did a full install, and for whatever reason, I get the error above. (Keep in mind that I've used dozens of laptops/desktops over the past 3 years and only recently experienced this issue)
I'll add that I fully agree this will very likely cause versioning issues in the not-too-distant future...
While I don't blame you as a user, my message is precisely to eliminate:
Your assumption is incorrect as I did a full install, and for whatever reason, I get the error above. (Keep in mind that I've used dozens of laptops/desktops over the past 3 years and only recently experienced this issue)
There is I claim no way this could happen. If there were, I would love to see it, and would be happy to look into it. Otherwise though, my assumption remains, I assume the only way any user could get into this state is by doing something as I say causes general poor behavior and isn't supported (namely running partial installs).
@Julian This occurred after I did a fresh install and then installed CUDA-enabled PyTorch.
A fresh install of what? That sounds precisely like you're saying you did the thing I said causes issues.
Apologies for coming across as passive aggressive. I edited my comment after re-reading it and realizing I sounded like an arse.
I downloaded and did a clean install of the most recent version of Anaconda. The only thing I can think of that I did that could have possibly caused an issue was from installing PyTorch and CUDA. However, I created a virtual env before doing this, so I don't think it would make the notebook completely break, right?
(No worries, I didn't see the edit, but now I do, so now I've edited mine. No hard feelings certainly.)
I downloaded and did a clean install of the most recent version of Anaconda.
But then you ran pip install
for the CUDA-enabled PyTorch? Or how did you do that install?
I honestly don't use Anaconda so I am no expert, but I would assume indeed that if you did run pip install
to do that that that definitely could cause an issue (As presumably the base environment was set up using conda
).
As a quick caveat, I am not a fan of using conda for any installs because of the high likelihood for conflicting issues arising from needing to use 'pip install'. B/C of the computing environment my project is in, I am forced to use Anaconda.
I do think I broke it previously by using pip install
within a conda environment. After I realized I did that, I uninstalled Anaconda, did a clean install, and then followed the following instructions from the NVidia website:
Maybe I'll just try to do everything using pip instead of conda? I'll uninstall, reinstall, and then try this method. I'll post an update after I do this later this evening.
Please try: pip install jupyter notebook -U
Hit same error
File "/Users/sophia/.pyenv/versions/3.11.2/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'
I solved it by
pip install --upgrade jupyterlab jupyterlab_server jupyter_server traitlets nbformat
as per this post
Thanks!
Getting this error with the latest Arch package version