DonJayamanne / vscodeJupyter

Jupyter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter
MIT License
334 stars 34 forks source link

forbidden #103

Open Kyeongpil opened 6 years ago

Kyeongpil commented 6 years ago

Environment data

VS Code version: 1.19.1 Jupyter Extension version: 1.1.4 OS and version: MacOS High Sierra 10.13.2

Logs

Output from Jupyter output panel , ({"message": "Forbidden"}) , ({"message": "Forbidden"}) , ({"message": "Forbidden"}) , ({"message": "Forbidden"}) Output from Console window (Help->Developer Tools menu)

[I 01:15:26.477 NotebookApp] http://localhost:8889/ [I 01:15:26.477 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [W 01:15:40.668 NotebookApp] Forbidden [W 01:15:40.668 NotebookApp] 403 GET /api/kernelspecs?1515600940661 (127.0.0.1) 1.63ms referer=None [W 01:17:45.624 NotebookApp] Forbidden [W 01:17:45.625 NotebookApp] 403 GET /api/kernelspecs?1515601065620 (127.0.0.1) 1.26ms referer=None

I created new jupyter notebook in VS Code and then I execute cell but there were forbidden errors.

How can I solve this problem??

DonJayamanne commented 6 years ago

Please could you upload some sample code so I could relate this at my end.

mdob2k commented 6 years ago

Same here on Windows 10 x64 (latest updates). As far as I can tell, the extension doesn't launch a notebook / can't connect to Jupyter kernel. It seems as if there are multiple notebooks still running. In some cases, using taskkill to end all jupyter-notebook and python processes or restarting the OS would help.

waio1990 commented 6 years ago

This might help someone, what I did was copy the token url from the jupyter notebook output tab (down right) and insert it in the "enter url of local/remote notebook" promt.

puppyapple commented 6 years ago

same problem here since yesterday

puppyapple commented 6 years ago

[I 13:36:30.530 NotebookApp] The port 8888 is already in use, trying another port. [I 13:36:30.587 NotebookApp] JupyterLab beta preview extension loaded from E:\Anaconda3\lib\site-packages\jupyterlab [I 13:36:30.587 NotebookApp] JupyterLab application directory is E:\Anaconda3\share\jupyter\lab [I 13:36:30.672 NotebookApp] Serving notebooks from local directory: D:\标签图谱\测试代码\Tag_graph [I 13:36:30.673 NotebookApp] 0 active kernels [I 13:36:30.673 NotebookApp] The Jupyter Notebook is running at: [I 13:36:30.674 NotebookApp] http://localhost:8889/ [I 13:36:30.674 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [W 13:36:56.836 NotebookApp] Forbidden [W 13:36:56.837 NotebookApp] 403 GET /api/kernelspecs?1524116216834 (127.0.0.1) 1.98ms referer=None [I 13:37:14.350 NotebookApp] 302 POST /login?next=%2F (::1) 2.01ms [I 13:37:14.361 NotebookApp] 302 GET / (::1) 0.99ms

puppyapple commented 6 years ago

, ({"message": "Forbidden", "reason": null}) , ({"message": "Forbidden", "reason": null}) , ({"message": "Forbidden", "reason": null})

andreymrt commented 6 years ago

I've been having this problem, thought it was an extension bug so I stepped through the code, turns out that "jupyter notebook list" was returning stale values, and that waitForNotebookToStart() in src\jupyterServices\notebook\utils.ts pulls out the token for the first session it finds

solution: delete the stale files located at %APPDATA%\jupyter\runtime\nbserver-*.json

There's a separate bug where closing vscode leaves an unattached notebook process running (don't know if it's a bug or feature), but if you've been killing those memory hungry processes with taskmanager that could be causing the problem.

@DonJayamanne, in looking at this, I ended up refactoring some of the code away from promise then(), catch() (was going cross-eyed following and stepping that logic) to async/await (much cleaner looking IMO). It compiled and ran fine with target: "es2017" under latest stable vscode. Any plans to refactor parts of the plugin? (would make it easier to contribute)