Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tornado 5.X doesn't have required WebsocketProtocol13.is_closing() method #5920

Closed
dhuntley1023 opened this issue Dec 29, 2020 · 12 comments · Fixed by #5933
Closed

tornado 5.X doesn't have required WebsocketProtocol13.is_closing() method #5920

dhuntley1023 opened this issue Dec 29, 2020 · 12 comments · Fixed by #5933

Comments

@dhuntley1023
Copy link

I created a Conda environment based on the spec "pandas-profiling=2 prompt_toolkit=2 dataprep".

When I load a notebook from this environment, I get the error below from handlers.py that indicates that a method, is_closing(), doesn't exist on the object stored in the ws_connection attribute. I tracked the cause down to the dataprep module in the environment forcing a load of tornado=5.0.2. This is an acceptable version for notebook according to the build dependencies, but the required method doesn't exist on the WebsocketProtocol13 class in that version of tornado. I haven't researched extensively when it was added, but it's definitely there in the 6.1 version.

My recommendation is to update the required version of tornado to 6.X or otherwise eliminate the dependency on this method.

TRACEBACK:
Traceback (most recent call last):
File "c:\Miniconda\envs\dataprep\lib\site-packages\tornado\web.py", line 1499, in _stack_context_handle_exception
raise_exc_info((type, value, traceback))
File "", line 4, in raise_exc_info
File "c:\Miniconda\envs\dataprep\lib\site-packages\tornado\stack_context.py", line 315, in wrapped
ret = fn(*args, **kwargs)
File "c:\Miniconda\envs\dataprep\lib\site-packages\notebook\services\kernels\handlers.py", line 207, in nudge
if self.ws_connection is None or self.ws_connection.is_closing():
AttributeError: 'WebSocketProtocol13' object has no attribute 'is_closing'

@dhuntley1023
Copy link
Author

The dependency on tornado 6.X looks like it was introduced in 6.1.6 with PR #5908. Tagging @minrk to take a look.

@ajfriend
Copy link

ajfriend commented Jan 2, 2021

Ran across this bug just now. I was confused for a second (probably due to only scanning the text above) and thought the bug was due to tornado==6.1.6, but it is (now that I actually read the thing, obviously) not.

Just for the sake of easy googleability for any future debuggers (until the issue is fixed), specifying

notebook<6.1.6

solved the issue for me.

@kevin-bates
Copy link
Member

Thanks for opening this issue @dhuntley1023 (and confirmation @ajfriend).

My recommendation is to update the required version of tornado to 6.X or otherwise eliminate the dependency on this method.

Agreed. I'll add that if we're going to move the floor of tornado, I recommend moving to >= 6.1 (similar to jupyter_server) so as to "capture" the tornado update for the Windows event loop policy. (#5907)

In the meantime, as a workaround, it would be better for folks to upgrade tornado rather than downgrade notebook - if that's possible.

cc: @minrk, @SylvainCorlay

@orsaada
Copy link

orsaada commented Jan 4, 2021

sudo -H pip install jupyterlab -U

fixed it for me on macos

@SonakshiGrover
Copy link

Thanks for bringing this up @dhuntley1023
Thanks @ajfriend for clarifying on the notebook version. Adding to - 'the sake of easy googleability', my python kernel was stuck at 'Kernel connecting' because of this websocket error.

I uninstalled notebook via
conda uninstall notebook
and then installed the specific version
conda install notebook=6.1.4
and finally
conda install jupyterlab

and I don't see the issue anymore.

(I am using Tornado 5.1.1)

@pytlv
Copy link

pytlv commented Jan 7, 2021

Had the same problem.
Upgraded Tornado and now all is good!
Follow this routine:

pip show tornado
Name: tornado
Version: 5.1.1
....
pip install tornado -U
pip show tornado
Name: tornado
Version: 6.1
...

Restarted Jupyter ==> Solved!

@eldadcohen1
Copy link

Thanks @SonakshiGrover it works.

@kevin-bates
Copy link
Member

I think, given the frequency that folks are encountering this, coupled with the importance of the fix that introduced the dependency change (in #5908), it's best we go ahead and increase the minimum version of tornado.

@ajfriend
Copy link

I'm seeing this problem again, and I can't use the above fixes because I have a dependency that requires tornado<6. The issue also looks like it may have something to due with a recent update to jedi. After playing around with the pip dependency resolver a bit, the following works for me:

jedi<0.18
notebook<6.1.6
tornado<6

But again, this is only because I'm stuck with tornado<6, otherwise, I'm guessing the above fixes should work.

@kevin-bates
Copy link
Member

OK. The jedi issue is separate (regarding auto-completion) and being handled in ipython. The bump of tornado was to prevent others from running into this issue after upgrading to 6.1.6.

I agree, anyone with additional tornado dependencies will need to figure out the path of least resistance - which you have done. Thank you for spelling those out for others in the same boat.

@asadblinks
Copy link

Thanks for bringing this up @dhuntley1023
Thanks @ajfriend for clarifying on the notebook version. Adding to - 'the sake of easy googleability', my python kernel was stuck at 'Kernel connecting' because of this websocket error.

I uninstalled notebook via
conda uninstall notebook
and then installed the specific version
conda install notebook=6.1.4
and finally
conda install jupyterlab

and I don't see the issue anymore.

(I am using Tornado 5.1.1)

Hello, I had the same issue this morning but this helped. Thank you.

@mossydidar
Copy link

Had the same problem.
Upgraded Tornado and now all is good!
Follow this routine:

pip show tornado
Name: tornado
Version: 5.1.1
....
pip install tornado -U
pip show tornado
Name: tornado
Version: 6.1
...

Restarted Jupyter ==> Solved!

Thanks! This worked smoothly!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants