Code Monkey home page Code Monkey logo

vscode-binder's Introduction

VS Code on Binder

PyPI Install with conda

VS Code on Binder, because sometimes you need a real editor.

Try it: Binder

vscode-binder's People

Contributors

betatim avatar dependabot[bot] avatar fhoehle avatar janjagusch avatar jdkent avatar nthiery avatar tkukurin avatar xhochy avatar yuvipanda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-binder's Issues

vscode shows in jupyterlab but not jupyterhub

In the same machine and same anaconda3 env, after install jupyter_vscode_proxy, vscode icon shows up in jupyterlab, but in jupyterhub, it disappears. Is there any diffrence for jupyterhub ? I'd like vscode embeded in jupyterhub to manage user auth. Thank you.

postBuild error and unable to install extensions on setup

Hi,

I was trying to install additional extensions but the call to code-server is failing in the postBuild. If you check in vscode, from your repo binder example, it doesn't have the python extension installed. But you can install it from within vscode with no problem.

I can't debug the problem using the repo2docker on my current machine, but here is a minimal code example to reproduce the error

#!/bin/bash
set -ex
code-server --version

minimal-repro
Binder
image

Thanks a lot for this tool! It's pretty awesome to be able to do this, and extremely useful for teaching.

How do I convert this to work with Jupyterhub

I converted this to jupyternote book image using repo2docker. I used that notebook image in Jupyterhub but the pod crashed while starting. The logs are below>

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/traitlets/config/application.py", line 563, in _load_config_files
    config = loader.load_config()
  File "/usr/local/lib/python3.6/site-packages/traitlets/config/loader.py", line 457, in load_config
    self._read_file_as_dict()
  File "/usr/local/lib/python3.6/site-packages/traitlets/config/loader.py", line 489, in _read_file_as_dict
    py3compat.execfile(conf_filename, namespace)
  File "/usr/local/lib/python3.6/site-packages/ipython_genutils/py3compat.py", line 198, in execfile
    exec(compiler(f.read(), fname, 'exec'), glob, loc)
  File "/binderhub_config.py", line 87, in <module>
    hub_url = urlparse(c.BinderHub.hub_url)
  File "/usr/local/lib/python3.6/urllib/parse.py", line 367, in urlparse
    url, scheme, _coerce_result = _coerce_args(url, scheme)
  File "/usr/local/lib/python3.6/urllib/parse.py", line 123, in _coerce_args
    return _decode_args(args) + (_encode_result,)
  File "/usr/local/lib/python3.6/urllib/parse.py", line 107, in _decode_args
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
  File "/usr/local/lib/python3.6/urllib/parse.py", line 107, in <genexpr>
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
AttributeError: 'LazyConfigValue' object has no attribute 'decode'

running jupyter notebooks in vscode

Very useful little extension!

Curious if anyone has successfully run a jupyter notebook using the extension? Seems to be a bit of a mess of port conflicts, I'm not really sure where to start debugging.

Documentation ?

Hi, I had a user report an issue when using jupyter-vscode-proxy with a package I had published.

Ref: corridor/configurable-http-proxy#16

I thought I'd try debugging and seeing if there is any issue with your library and mine working together.
But I couldn't find any instructions on what this project aims to do nor how to setup a quick start to test it out

I checked:

  • README
  • The examples folder
  • And couldn't see any links to a github wiki nor a readthedocs

Could you point me to some resources I could use to help out @VitaliyFedorov

Make this repo work with python and jupyter extensions

Making the Python and Jupyter extensions work nicely on code-server is not easy. You can see that from other issues in this repo and from the code-server github issues list. You need specific versions of code-server and specific versions of the python and jupyter extensions.

My suggestion would be to pin versions of code-server, python extension and jupyter extension to something that works.

Would be really helpful.

(Unfortunately I don't know recent version that work well together. I'm trying to find them.)

VS-Code starts blank in our JupyterHub setup (websocket failure)

This is presumably an issue in our local setup rather than vscode-binder,
but here is hopefully a reasonable location to keep a record; also in case
this rings a bell.

Setup

Jupyterhub 0.8.1 running on a single server with DockerSpawner.
Image configuration from: https://gitlab.in2p3.fr/jupyterhub-paris-saclay/image/
(see the Dockerfile and environment.yml; docker image available from
Packages -> Container Registry).

Symptoms

The installation of vscode and the jupyter proxy presumably went smoothly.
VS Code appears as expected in the jupyter(lab) menu/launcher.
When running the docker container locally, VS Code works correctly.

However when launching VS Code in the same way from our JupyterHub, I get a blank screen.
In the JavaScript console, I get:

findTextAreas: running over 1 textareas.js:38:26
 INFO Error while creating indexedDB log provider. Falling back to in-memory log provider. log.ts:184:11
  ERR DOMException: "A mutation operation was attempted on a database that did not allow mutations." log.ts:196:11
Firefox ne peut établir de connexion avec le serveur à l’adresse wss://jupytercloud.lal.in2p3.fr/jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/?reconnectionToken=787a1474-2047-42e1-a477-144beb66bfce&reconnection=false&skipWebSocketFrames=false. browserSocketFactory.ts:162:30
  ERR [remote-connection][Management   ][787a1…][initial][jupytercloud.lal.in2p3.fr:80] socketFactory.connect() failed. Error: log.ts:196:11
  ERR Error: "WebSocket close with status code 1006"
    s remoteAuthorityResolver.ts:55
    l browserSocketFactory.ts:129
log.ts:196:11
  ERR [remote-connection] An error occurred in the very first connect attempt, it will be treated as a permanent error! Error: log.ts:196:11
  ERR Error: "WebSocket close with status code 1006"
    s remoteAuthorityResolver.ts:55
    l browserSocketFactory.ts:129
log.ts:196:11
  ERR Error: "WebSocket close with status code 1006"
    s remoteAuthorityResolver.ts:55
    l browserSocketFactory.ts:129
log.ts:196:11

In the Jupyter log, I get:

[I 2020-05-12 06:55:05.407 SingleUserNotebookApp log:174] 302 GET /jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/ -> /jupyter/hub/api/oauth2/authorize?client_id=user-nicolas.thiery-at-u-psud.fr&redirect_uri=%2Fjupyter%2Fuser%2Fnicolas.thiery-at-u-psud.fr%2Foauth_callback&response_type=code&state=[secret] (@127.0.0.1) 1.43ms
[E 2020-05-12 06:55:05.407 SingleUserNotebookApp web:1792] Uncaught exception GET /jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/ (127.0.0.1)
    HTTPServerRequest(protocol='http', host='jupytercloud.lal.in2p3.fr', method='GET', uri='/jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.7/site-packages/tornado/web.py", line 1703, in _execute
        result = await result
      File "/opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/websocket.py", line 97, in get
        return await self.http_get(*args, **kwargs)
      File "/opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py", line 534, in http_get
        return await self.proxy(self.port, path)
    TypeError: object NoneType can't be used in 'await' expression
[I 2020-05-12 06:55:05.418 SingleUserNotebookApp log:174] 302 GET /jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/static-/out/vs/workbench/workbench.web.api.js -> /jupyter/hub/api/oauth2/authorize?client_id=user-nicolas.thiery-at-u-psud.fr&redirect_uri=%2Fjupyter%2Fuser%2Fnicolas.thiery-at-u-psud.fr%2Foauth_callback&response_type=code&state=[secret] (@127.0.0.1) 1.20ms
[E 2020-05-12 06:55:05.418 SingleUserNotebookApp web:1792] Uncaught exception GET /jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/static-/out/vs/workbench/workbench.web.api.js (127.0.0.1)
    HTTPServerRequest(protocol='http', host='jupytercloud.lal.in2p3.fr', method='GET', uri='/jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/static-/out/vs/workbench/workbench.web.api.js', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.7/site-packages/tornado/web.py", line 1703, in _execute
        result = await result
      File "/opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/websocket.py", line 97, in get
        return await self.http_get(*args, **kwargs)
      File "/opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py", line 534, in http_get
        return await self.proxy(self.port, path)
    TypeError: object NoneType can't be used in 'await' expression
[I 2020-05-12 06:55:05.420 SingleUserNotebookApp log:174] 302 GET /jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/static-/out/vs/workbench/workbench.web.api.nls.js -> /jupyter/hub/api/oauth2/authorize?client_id=user-nicolas.thiery-at-u-psud.fr&redirect_uri=%2Fjupyter%2Fuser%2Fnicolas.thiery-at-u-psud.fr%2Foauth_callback&response_type=code&state=[secret] (@127.0.0.1) 1.10ms
[E 2020-05-12 06:55:05.420 SingleUserNotebookApp web:1792] Uncaught exception GET /jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/static-/out/vs/workbench/workbench.web.api.nls.js (127.0.0.1)
    HTTPServerRequest(protocol='http', host='jupytercloud.lal.in2p3.fr', method='GET', uri='/jupyter/user/nicolas.thiery-at-u-psud.fr/vscode/static-/out/vs/workbench/workbench.web.api.nls.js', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/opt/conda/lib/python3.7/site-packages/tornado/web.py", line 1703, in _execute
        result = await result
      File "/opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/websocket.py", line 97, in get
        return await self.http_get(*args, **kwargs)
      File "/opt/conda/lib/python3.7/site-packages/jupyter_server_proxy/handlers.py", line 534, in http_get
        return await self.proxy(self.port, path)
    TypeError: object NoneType can't be used in 'await' expression

code-server 3.2 is incompatible with this repository

Just a heads up:

code-server 3.2 was freshly released on conda-forge, and unless I did something very silly, it will break the repo quite dramatically

image

that's what I see in the server logs.

Error: Cannot find module '/share/code-server/out/node/entry.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Not sure if this is the best place to report, but it seems to be useful to pin to an older version in the interim.

VSCode button not showing up (GESIS Notebooks)

Proof

I have a repo which i forked from a school project, and wanted a vscode editor in my repo. No biggie, added the `conda install jupyter-vscode-proxy` into by postBuild file, and waited until it booted up. When it did, i was shocked when i found out that it doesn't work. I tried conda-forge, i tried pip, none of which worked

Uncaught Exception: Error: ENOENT: no such file or directory .local/share/code-server/Backups/workspaces.json

Hi @betatim ,
First I'd like to thank you for this great plugin.
However, some times I got the following error in my jupyter lab terminal:

INFO  code-server v1.32.0-282
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/Users/andrewssobral/.local/share/code-server","working-dir":"/Users/andrewssobral/Projects","log-dir":"/Users/andrewssobral/.cache/code-server/logs/20190317003928880"}
INFO  Starting webserver... {"host":"0.0.0.0","port":60464}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://coder.com/docs
WARN  Launched without authentication.
INFO   
INFO  Started (click the link below to open):
INFO  http://localhost:60464/
INFO   
INFO  Starting shared process [1/5]...
[I 01:39:30.926 LabApp] Trying to establish websocket connection to ws://localhost:60464/
[I 01:39:30.937 LabApp] Websocket connection established to ws://localhost:60464/
INFO  WebSocket opened / {"client":1,"ip":"127.0.0.1"}
INFO  Connected to shared process
ERROR SHARED stderr {"data":"Uncaught Exception:  Error: Unexpected end of JSON input\n\nSyntaxError: Unexpected end of JSON input\n    at JSON.parse (<anonymous>)\n    at pfs_1.readFile.then.contents (eval at exports.requireModule (/usr/local/bin/code-server:468:27661), <anonymous>:77406:45)\n    at <anonymous>\n    at Timeout.setTimeout [as _onTimeout] (eval at exports.requireModule (/usr/local/bin/code-server:468:27661), <anonymous>:52669:31)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:290:5)\n"}

and it freezes the jupyter lab web interface as well the code-server web interface.
I tried to do this manually:

mkdir  /Users/andrewssobral/.local/share/code-server/Backups/
touch /Users/andrewssobral/.local/share/code-server/Backups/workspaces.json

but the error persist. Do you know what it can be?

The installation of the ms-python.python fails

For information: the current postBuild script tries to install ms-python.python, and fails to do so:

code-server --install-extension ms-python.python
Installing extensions...
Extension 'ms-python.python' not found.
Make sure you use the full extension ID, including the publisher, e.g.: ms-vscode.csharp
error undefined

It does not seem to matter much. I only stumbled on it because I was trying to replicate the postBuild script by a sequence of RUN commands in my Dockerfile.

Can't connect errors on hub.mybinder.turing.ac.uk

Using the binder badge in this repo readme, opening VSCode seems to work, but is immediately followed by 'Disconnected' error pop-ups that keep showing up:

Screenshot 2020-06-02 10 42 15

Seems like there are lots of javascript errors looking at a web console, but I'm not sure how to interpret them...

Allow to switch the icon to code-server icon

Currently the VS Code icon is used even when code-server is run. This is problematic because the Visual Studio Code icon is a Microsoft trademark and should not be used to represent products other than VS Code as per https://code.visualstudio.com/brand

Proposed solution:

Any thoughts/counter ideas before I open a PR?

Generalize the extension / repo

This repo is constructed to work with repo2docker which is great and fulfills the original purpose of spinning up VSCode on Binder. Would it be useful to provide a more general Dockerfile based on jupyter/base-notebook for those who don't use repo2docker and/or binder but do use the Jupyter stack in their docker images?

Factor out a conda package

This VS Code integration is amazing! I am setting it up for our local jupyterhub.

Could a conda (pip?) package be factored out of this repository so that one would just
need to mention it in one's environment.yml? The package would take care of:

  • Listing the dependencies
  • Providing the vscode proxy
  • Running what's currently in the postBuild script

Proxy breaks with VSCode >= v4.10.1

Hey and thank you for creating and maintaining this very useful plugin!

We've been using it for quite a while but noticed it doesn't work for newer VSCode versions.

Reading the proxy's log, it becomes evident it cannot open up a WebSocket connection. I assume this is due to VSCode requiring an origin header starting with VSCode 4.10.1.
You can even see it failing at "ensureOrigin".

As a temporary fix: using v4.10.0 works fine.

Thanks!

[10:52:31] Extension host agent started. 
74 [I 2023-04-03 10:52:31.943 ServerApp] 302 GET /notebook/maintenance/vscodetest1/vscode/ (
[[email protected]](mailto:[email protected])
) 1669.19ms 
75 [I 2023-04-03 10:52:33.471 ServerApp] Trying to establish websocket connection to ws://localhost:44579/stable-5e805b79fcb6ba4c2d23712967df89a089da575b?reconnectionToken=b74173bd-079c-415c-a1dc-61e514670497&reconnection=false&skipWebSocketFrames=false 
76 [2023-04-03T08:52:33.476Z] error Forbidden HttpError: Forbidden 
77     at ensureOrigin (/usr/lib/code-server/out/node/http.js:288:15) 
78     at wrapped (/usr/lib/code-server/out/node/wsRouter.js:64:24) 
79     at Layer.handle [as handle_request] (/usr/lib/code-server/node_modules/router/lib/layer.js:102:15) 
80     at next (/usr/lib/code-server/node_modules/router/lib/route.js:144:13) 
81     at Route.dispatch (/usr/lib/code-server/node_modules/router/lib/route.js:109:3) 
82     at handle (/usr/lib/code-server/node_modules/router/index.js:515:11) 
83     at Layer.handle [as handle_request] (/usr/lib/code-server/node_modules/router/lib/layer.js:102:15) 
84     at /usr/lib/code-server/node_modules/router/index.js:291:22 
85     at param (/usr/lib/code-server/node_modules/router/index.js:368:14) 
86     at param (/usr/lib/code-server/node_modules/router/index.js:379:14) 
87     at Function.process_params (/usr/lib/code-server/node_modules/router/index.js:424:3) 
88     at next (/usr/lib/code-server/node_modules/router/index.js:285:10) 
89     at Function.handle (/usr/lib/code-server/node_modules/router/index.js:184:3) 
90     at router (/usr/lib/code-server/node_modules/router/index.js:59:12) 
91     at Layer.handle [as handle_request] (/usr/lib/code-server/node_modules/router/lib/layer.js:102:15) 
92     at trim_prefix (/usr/lib/code-server/node_modules/router/index.js:330:13) 
93     at /usr/lib/code-server/node_modules/router/index.js:294:7 
94     at Function.process_params (/usr/lib/code-server/node_modules/router/index.js:349:12) 
95     at Immediate.next (/usr/lib/code-server/node_modules/router/index.js:285:10) 
96     at Immediate.<anonymous> (/usr/lib/code-server/node_modules/router/index.js:671:15) 
97     at processImmediate (node:internal/timers:468:21) 
98 [E 2023-04-03 10:52:33.477 ServerApp] Uncaught exception GET /notebook/maintenance/vscodetest1/vscode/stable-5e805b79fcb6ba4c2d23712967df89a089da575b?reconnectionToken=b74173bd-079c-415c-a1dc-61e514670497&reconnection=false&skipWebSocketFrames=false (127.0.0.6)

Maintenance

Hello @betatim, not sure how much motivation you have on keeping to maintain this here. We are heavy users of this extension. Currently, we are blocked by #32 from upgrading to a new code-server version. This repo only works with code-server<4. One thing forward for us would be to merge the PR but then we will come to the point where a release is necessary and a bit of github automation would probably be nice. Happy to contribute that but:

  1. Do you have the time/motivation to review this?
  2. Should we instead fork this and do our own maintenance?
  3. Would you trust me as a second maintainer here (instead of forking)?

Python interactive window doesn't work in Binder

First, I've been looking for a good way to do this for weeks! Thank you for the repo.

I'm interested in helping people get started with Python and VS Code and I wanted to have a free Binder VS Code instance to point people to, where they can work as if they had VS Code installed on their local machine. Much like Github Codespaces.

This repo is almost exactly that except that the interactive window doesn't work in the Binder-launched VS Code instance. I'm not sure where the issue is but, usually, right-clicking on a code selection and choosing the "Run in interactive window" option would launch VS Code's interactive window. Currently, it doesn't do anything. If the repo could be tweaked so that this works out of the box, that would be amazing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.