Search code examples
pythonubuntujupytergoogle-colaboratory

problems using local jupyter with google colab


I am using jupyter notebook with google colab, on Ubuntu 20.04LTS with Python 3.8.5.

Problems I face are:

  1. connection drops suddenly. I mean, to say, colab never executes a cell, instead it just keeps waiting. By waiting, I mean, the cell I run always looks like this enter image description here and never turns into this: enter image description here. But, colab does say that I am connected to an instance: enter image description here.
  2. everytime I write something and wait for autocomplete to show suggestions, I receive a TypeError that says, there was unexpected keyword argument 'column'. Here's the complete error message right from the launch of jupyter:
(piu_venv) ubuntu@ip-xxx-xxx-xxx-xxx:~/pump_it_up$ jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=8888 --NotebookApp.port_retries=0
jupyter_http_over_ws extension initialized. Listening on /http_over_websocket
[I 07:14:12.316 NotebookApp] Serving notebooks from local directory: /home/ubuntu/pump_it_up
[I 07:14:12.316 NotebookApp] Jupyter Notebook 6.2.0 is running at:
[I 07:14:12.316 NotebookApp] http://localhost:8888/?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
[I 07:14:12.316 NotebookApp]  or http://127.0.0.1:8888/?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
[I 07:14:12.316 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 07:14:12.319 NotebookApp] No web browser found: could not locate runnable browser.
[C 07:14:12.319 NotebookApp] 
    
    To access the notebook, open this file in a browser:
        file:///home/ubuntu/.local/share/jupyter/runtime/nbserver-11870-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
     or http://127.0.0.1:8888/?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
[I 07:14:19.632 NotebookApp] 302 GET /?token=0b923e1d3d46db65bf3fe322c20bc0e4f5515f243873e2f7 (127.0.0.1) 0.250000ms
[I 07:14:19.634 NotebookApp] 302 GET /tree?token=0b923e1d3d46db65bf3fe322c20bc0e4f5515f243873e2f7 (127.0.0.1) 0.330000ms
[W 07:14:19.657 NotebookApp] Forbidden
[W 07:14:19.657 NotebookApp] 403 GET /api/kernelspecs (127.0.0.1) 0.420000ms referer=None
[I 07:14:23.317 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.240000ms
[I 07:14:23.461 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.230000ms
[I 07:14:23.478 NotebookApp] Kernel started: 2442098f-efe2-44fa-8916-2b8081a4904b, name: python3
[I 07:14:23.968 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.270000ms
[I 07:14:23.971 NotebookApp] proxying WebSocket connection to: ws://localhost:8888/api/kernels/2442098f-efe2-44fa-8916-2b8081a4904b/channels?session_id=dd75a32fa4b4426587f78beb823c6122&jupyter_http_over_ws_auth_url=http%3A%2F%2Flocalhost%3A8888%2F%3Ftoken%3Dc5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1
[I 07:14:26.402 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.260000ms
[I 07:14:45.852 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.280000ms
[I 07:14:47.477 NotebookApp] 302 GET /?token=c5d00b63744c7a6cd9229df8340c46bc18506d3994c208e1 (127.0.0.1) 0.230000ms
[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 265, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/tornado/gen.py", line 762, in run
    value = future.result()
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/tornado/gen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 580, in complete_request
    matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 356, in do_complete
    return self._experimental_do_complete(code, cursor_pos)
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 381, in _experimental_do_complete
    completions = list(_rectify_completions(code, raw_completions))
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 484, in rectify_completions
    completions = list(completions)
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 1818, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 1861, in _completions
    matched_text, matches, matches_origin, jedi_matches = self._complete(
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 2029, in _complete
    completions = self._jedi_matches(
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/IPython/core/completer.py", line 1373, in _jedi_matches
    interpreter = jedi.Interpreter(
  File "/home/ubuntu/pump_it_up/piu_venv/lib/python3.8/site-packages/jedi/api/__init__.py", line 725, in __init__
    super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

Details about computer:
This is actually an AWS EC2 instance(c5a.4xlarge) I have port mapped to my local laptop, to be able to use jupyter notebook on colab. Both my laptop and EC2 instance are running Ubuntu 20.04LTS.

Package versions:
I have installed jupyter on 16-Jan-2021 by doing pip3 install jupyter. So, I believe I got the latest version available and here are the package versions along with some dependencies of jupyter:

ipykernel==5.4.3
ipython==7.19.0
ipython-genutils==0.2.0
ipywidgets==7.6.3
jedi==0.18.0
Jinja2==2.11.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.11
jupyter-console==6.2.0
jupyter-core==4.7.0
jupyter-http-over-ws==0.0.8
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.0
kiwisolver==1.3.1
MarkupSafe==1.1.1
matplotlib==3.3.3
mistune==0.8.4
mpmath==1.1.0
nbclient==0.5.1
nbconvert==6.0.7
nbformat==5.1.2
nest-asyncio==1.4.3
notebook==6.2.0

How do I fix these issues?


Solution

  • The second issue is caused by your jedi version. You can fix it with:

    pip install --upgrade 'jedi<0.18.0'
    

    Related issue & discussion: https://github.com/ipython/ipython/issues/12745#issuecomment-751892538