jupyter / colaboratory

[deprecated] Jupyter CoLaboratory, goto google colab now
https://colab.research.google.com
BSD 3-Clause "New" or "Revised" License
740 stars 111 forks source link

Problem with connecting to a local IPython Kernel when running from colaboratory.jupyter.org #111

Closed stared closed 7 years ago

stared commented 9 years ago

While trying to connect to a local IPython Kernel, I am getting a CORS error:

XMLHttpRequest cannot load http://127.0.0.1:8888/api/sessions.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://colaboratory.jupyter.org' is therefore not allowed access. 

How can I solve it?

It works fine when run locally with $ python -m colaboratory.

gdw2 commented 7 years ago

I had to add the following options to my notebook:

--NotebookApp.token='' --NotebookApp.disable_check_xsrf=True --NotebookApp.allow_origin="*"

ruffsl commented 7 years ago

@gdw2 , just tried your added arguments and got a little further, but I'm still not able to execute cells. This appears in my jupyter session output when I attempt to connect:

[W 21:50:36.336 NotebookApp] Sessions API changed, see updated swagger docs
[I 21:50:36.372 NotebookApp] Kernel started: 1779e3dc-ff57-445b-8731-43b49ed4766e
[W 21:50:36.415 NotebookApp] 404 GET /api/kernels/1779e3dc-ff57-445b-8731-43b49ed4766e/shell (127.0.0.1) 37.24ms referer=None

Again + --debug

[W 21:59:13.183 NotebookApp] Sessions API changed, see updated swagger docs
[D 21:59:13.184 NotebookApp] No kernel specified, using default kernel
[D 21:59:13.208 NotebookApp] Found kernel python2 in /usr/local/share/jupyter/kernels
[D 21:59:13.211 NotebookApp] Starting kernel: [u'/usr/bin/python', u'-m', u'ipykernel_launcher', u'-f', u'/root/.local/share/jupyter/runtime/kernel-d8781267-9890-4424-ae14-e35f18b40116.json']
[D 21:59:13.215 NotebookApp] Connecting to: tcp://127.0.0.1:50572
[D 21:59:13.216 NotebookApp] Connecting to: tcp://127.0.0.1:54689
[I 21:59:13.217 NotebookApp] Kernel started: d8781267-9890-4424-ae14-e35f18b40116
[D 21:59:13.217 NotebookApp] Kernel args: {'kernel_name': None, 'cwd': u'/'}
[D 21:59:13.218 NotebookApp] 201 POST /api/sessions (127.0.0.1) 36.05ms
[D 21:59:13.224 NotebookApp] Using contents: services/contents
[D 21:59:13.256 NotebookApp] Path base/images/favicon.ico served from /usr/local/lib/python2.7/dist-packages/notebook/static/base/images/favicon.ico
[D 21:59:13.257 NotebookApp] Path components/jquery-ui/themes/smoothness/jquery-ui.min.css served from /usr/local/lib/python2.7/dist-packages/notebook/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css
[D 21:59:13.257 NotebookApp] Path components/jquery-typeahead/dist/jquery.typeahead.min.css served from /usr/local/lib/python2.7/dist-packages/notebook/static/components/jquery-typeahead/dist/jquery.typeahead.min.css
[D 21:59:13.257 NotebookApp] Path style/style.min.css served from /usr/local/lib/python2.7/dist-packages/notebook/static/style/style.min.css
[D 21:59:13.258 NotebookApp] Path components/es6-promise/promise.min.js served from /usr/local/lib/python2.7/dist-packages/notebook/static/components/es6-promise/promise.min.js
[D 21:59:13.258 NotebookApp] Path components/preact/index.js served from /usr/local/lib/python2.7/dist-packages/notebook/static/components/preact/index.js
[D 21:59:13.259 NotebookApp] Path components/proptypes/index.js served from /usr/local/lib/python2.7/dist-packages/notebook/static/components/proptypes/index.js
[D 21:59:13.259 NotebookApp] Path components/preact-compat/index.js served from /usr/local/lib/python2.7/dist-packages/notebook/static/components/preact-compat/index.js
[D 21:59:13.259 NotebookApp] Path components/requirejs/require.js served from /usr/local/lib/python2.7/dist-packages/notebook/static/components/requirejs/require.js
[D 21:59:13.260 NotebookApp] Path base/images/logo.png served from /usr/local/lib/python2.7/dist-packages/notebook/static/base/images/logo.png
[W 21:59:13.260 NotebookApp] 404 GET /api/kernels/d8781267-9890-4424-ae14-e35f18b40116/shell (127.0.0.1) 37.06ms referer=None
ca9 commented 7 years ago

Unhelpful comment but facing the same issue.

rgbkrk commented 7 years ago

This version of colaboratory is no longer supported, please switch to https://colab.research.google.com.