mozilla / jupyter-spark

Jupyter Notebook extension for Apache Spark integration
Mozilla Public License 2.0
193 stars 34 forks source link

Exception when running with Tornado v6 #52

Open dan-coates opened 5 years ago

dan-coates commented 5 years ago

Tornado 6.0 appears to have removed the tornado.web.asynchronous method, which handlers.py relies on:

[W 16:15:22.590 NotebookApp] Error loading server extension jupyter_spark
    Traceback (most recent call last):
      File "/usr/lib/python3.6/site-packages/notebook/notebookapp.py", line 1575, in init_server_extensions
        func(self)
      File "/usr/lib/python3.6/site-packages/jupyter_spark/__init__.py", line 30, in load_jupyter_server_extension
        from .handlers import SparkHandler
      File "/usr/lib/python3.6/site-packages/jupyter_spark/handlers.py", line 8, in <module>
        class SparkHandler(IPythonHandler):
      File "/usr/lib/python3.6/site-packages/jupyter_spark/handlers.py", line 13, in SparkHandler
        @tornado.web.asynchronous
    AttributeError: module 'tornado.web' has no attribute 'asynchronous'

This has been noted in jupyter/notebook#4311 which may have a path to a fix.

pip freeze of the environment this was run on under Python 3.6.8:

atomicwrites==1.3.0
attrs==19.1.0
backcall==0.1.0
beautifulsoup4==4.7.1
bleach==3.1.0
certifi==2019.3.9
chardet==3.0.4
decorator==4.4.0
defusedxml==0.5.0
docutils==0.14
entrypoints==0.3
idna==2.8
ipykernel==5.1.0
ipython==7.4.0
ipython-genutils==0.2.0
ipywidgets==7.4.2
jedi==0.13.3
Jinja2==2.10
jsonschema==3.0.1
jupyter==1.0.0
jupyter-client==5.2.4
jupyter-console==6.0.0
jupyter-core==4.4.0
jupyter-spark==0.4.0
MarkupSafe==1.1.1
mistune==0.8.4
more-itertools==7.0.0
nbconvert==5.4.1
nbformat==4.4.0
notebook==5.7.8
pandocfilters==1.4.2
parso==0.3.4
pexpect==4.6.0
pickleshare==0.7.5
pkginfo==1.5.0.1
pluggy==0.6.0
prometheus-client==0.6.0
prompt-toolkit==2.0.9
ptyprocess==0.6.0
py==1.8.0
Pygments==2.3.1
pyrsistent==0.14.11
pyspark==2.4.0
pytest==3.6.0
python-dateutil==2.8.0
pyzmq==18.0.1
qtconsole==4.4.3
readme-renderer==24.0
requests==2.21.0
requests-toolbelt==0.9.1
Send2Trash==1.5.0
six==1.12.0
soupsieve==1.9
terminado==0.8.2
testpath==0.4.2
tornado==6.0.2
tqdm==4.31.1
traitlets==4.3.2
twine==1.13.0
urllib3==1.24.1
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==3.4.2
AlJohri commented 5 years ago

Just ran into the same error:

[W 04:27:51.108 NotebookApp] Error loading server extension jupyter_spark
    Traceback (most recent call last):
      File "/opt/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 1575, in init_server_extensions
        func(self)
      File "/opt/anaconda3/lib/python3.7/site-packages/jupyter_spark/__init__.py", line 30, in load_jupyter_server_extension
        from .handlers import SparkHandler
      File "/opt/anaconda3/lib/python3.7/site-packages/jupyter_spark/handlers.py", line 8, in <module>
        class SparkHandler(IPythonHandler):
      File "/opt/anaconda3/lib/python3.7/site-packages/jupyter_spark/handlers.py", line 13, in SparkHandler
        @tornado.web.asynchronous
    AttributeError: module 'tornado.web' has no attribute 'asynchronous'
$ pip freeze | egrep "tornado|jupyter|spark"
jupyter==1.0.0
jupyter-client==5.2.4
jupyter-console==6.0.0
jupyter-core==4.4.0
jupyter-spark==0.4.0
jupyterlab==0.35.4
jupyterlab-server==0.2.0
tornado==6.0.2
jonjoncardoso commented 4 years ago

I'm having the same error, and I have the following related packages installed:

$ pip freeze | egrep "tornado|jupyter|spark|nbconvert"
findspark==1.3.0
handyspark==0.2.2a1
jupyter==1.0.0
jupyter-client==5.3.3
jupyter-console==6.0.0
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.4.0
jupyter-core==4.5.0
jupyter-highlight-selected-word==0.2.0
jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.4.0
jupyter-spark==0.4.0
jupyterhub==1.0.0
jupyterlab==1.1.3
jupyterlab-server==1.0.6
jupyterthemes==0.20.0
nbconvert==5.6.1
pyspark==2.4.4
spark-stratifier==0.1.5
tornado==6.0.3
birdsarah commented 4 years ago

I have a fix for this here: https://github.com/mdboom/jupyter-spark/pull/1/files#diff-4573d7094611852f6d7f7323f9395dc3L2-L25

blackvvine commented 4 years ago

For anybody else trying to just work around the issue until it is fixed, downgrading tornado should do the trick:

pip uninstall tornado nbconvert jupyter-spark
pip install tornado==5.1.1
pip install nbconvert==5.1.0
pip install jupyter-spark
cyberwillis commented 4 years ago

Hi guys ...

I was getting the same error today, was my first time using this:

File "/opt/anaconda3/lib/python3.7/site-packages/jupyter_spark/handlers.py", line 13, in SparkHandler
        @tornado.web.asynchronous

Then I take 2 min to discover this URI https://www.tornadoweb.org/en/stable/releases/v3.1.0.html?highlight=tornado.web.asynchronous#tornado-web :

The tornado.web.asynchronous decorator is no longer necessary for methods that return a Future

Then I just commented that decoration, build the package and installed. The result was :

Jupyter-Spark enabled!