question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't start Python interactive viewer for Jupyter cell

See original GitHub issue

Environment data

  • VS Code version: 1.29.0
  • Extension version (available under the Extensions sidebar): 2018.10.1 (09 Nov 2018)
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7 Anaconda
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
  • Relevant/affected Python packages and their versions: Jupyter notebook

Actual behavior

Try to execute cell in imported python notebook. Python interactive doesn’t start and freezes.

Expected behavior

The selected cell should have been executed in the Python Interactive pane.

Steps to reproduce:

  1. Open VSCode from an activated conda env in a dos shell

  2. Right click a .ipynb file and select “Import Jupyter Notebook”

  3. In the first code cell of the imported file file there is a Run Cell option.: image

  4. Click Run Cell and in the status bar appears a message that the Jupyter Server is starting: image

  5. The editing pane is vertically split and a new tab named “Python Interactive” appears with a blue bar moving horizontally image

  6. Nothing happens, Code isn’t executed. blue bar keeps rolling. Status bar stays with “starting…” message.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

Starting Microsoft Python language server.
Microsoft Python Language Server version 0.1.60.0
Initializing for D:\Anaconda3\envs\xxx\python.exe

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

In the log below, there is an error (I don’t have any Anaconda in C:)

console.ts:134 [Extension Host] Failed to get interpreter information for 'C:\Program Files\Anaconda\python.exe' Error: spawn C:\Program Files\Anaconda\python.exe ENOENT
	at _errnoException (util.js:1024:11)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
	at onErrorNT (internal/child_process.js:372:16)
	at _combinedTickCallback (internal/process/next_tick.js:138:11)
	at process._tickCallback (internal/process/next_tick.js:180:9)
t.log @ console.ts:134

There is the complete log.

extensionService.ts:1009 [PKief.markdown-checkbox]: Menu item references the same command as default and alt-command
TMSyntax.ts:47 Overwriting grammar scope name to file mapping for scope source.yaml.
Old grammar file: file:///d%3A/Program%20Files/Microsoft%20VS%20Code/resources/app/extensions/yaml/syntaxes/yaml.tmLanguage.json.
New grammar file: file:///c%3A/Users/PauloEduardo/.vscode/extensions/redhat.vscode-yaml-0.1.0/syntaxes/yaml.tmLanguage.json
e.register @ TMSyntax.ts:47
log.ts:157  INFO no standard startup: panel is active
console.ts:134 [Extension Host]% Array(66)
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Create file systemwatcher with pattern *\python.exe
console.ts:134 [Extension Host] Python Extension: Create file systemwatcher with pattern *\*\python.exe
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Create file systemwatcher with pattern *\python.exe
console.ts:134 [Extension Host] Python Extension: Create file systemwatcher with pattern *\*\python.exe
console.ts:134 [Extension Host] Python Extension: Display locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Notify locators are locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Detected refreshing of Interpreters, Arg 1: {}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Register Intepreter Watcher, Arg 1: {"$mid":1,"fsPath":"d:\\dev\\xxx","external":"file:///d%3A/dev/xxx","path":"/d:/dev/xxx","scheme":"file"}, Return Value: 
console.ts:134 [Extension Host] Python Extension: Register Intepreter Watcher, Arg 1: undefined, Return Value: 
console.ts:134 [Extension Host] Python Extension: Build the workspace interpreter watcher, Arg 1: {"$mid":1,"fsPath":"d:\\dev\\xxx","external":"file:///d%3A/dev/xxx","path":"/d:/dev/xxx","scheme":"file"}, Return Value: UNABLE TO DETERMINE VALUE
console.ts:134 [Extension Host] Python Extension: Build the workspace interpreter watcher, Arg 1: undefined, Return Value: UNABLE TO DETERMINE VALUE
console.ts:134 [Extension Host] Python Extension: Get language server folder name, , Return Value: "languageServer.0.1.60"
console.ts:134 [Extension Host] Failed to get interpreter information for 'C:\Program Files\Anaconda\python.exe' Error: spawn C:\Program Files\Anaconda\python.exe ENOENT
	at _errnoException (util.js:1024:11)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
	at onErrorNT (internal/child_process.js:372:16)
	at _combinedTickCallback (internal/process/next_tick.js:138:11)
	at process._tickCallback (internal/process/next_tick.js:180:9)
t.log @ console.ts:134
t._logExtensionHostMessage @ extensionHost.ts:437
(anonymous) @ extensionHost.ts:244
emitTwo @ events.js:126
emit @ events.js:214
emit @ internal/child_process.js:772
_combinedTickCallback @ internal/process/next_tick.js:141
_tickCallback @ internal/process/next_tick.js:180
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Git extension API method 'getGitPath' is deprecated.
t.log @ console.ts:134
t._logExtensionHostMessage @ extensionHost.ts:437
(anonymous) @ extensionHost.ts:244
emitTwo @ events.js:126
emit @ events.js:214
emit @ internal/child_process.js:772
_combinedTickCallback @ internal/process/next_tick.js:141
_tickCallback @ internal/process/next_tick.js:180
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Hide locator refreshing progress, , Return Value: 
console.ts:134 [Extension Host] Python Extension: All locators have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: Checking whether locactors have completed locating, , Return Value: 
console.ts:134 [Extension Host] Python Extension: [W 22:42:55.354 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.

console.ts:134 [Extension Host] Python Extension: [I 22:42:55.419 NotebookApp] Serving notebooks from local directory: C:\Users\PAULOE~1\AppData\Local\Temp

console.ts:134 [Extension Host] Python Extension: [I 22:42:55.419 NotebookApp] The Jupyter Notebook is running at:
[I 22:42:55.419 NotebookApp] http://(i7 or 127.0.0.1):8888/?token=6d81d530b1ffe2413845b87d86a3372c4d9b63f50ad6a2d8
[I 22:42:55.420 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

console.ts:134 [Extension Host] Python Extension: [C 22:42:55.425 NotebookApp] 
    
    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://(i7 or 127.0.0.1):8888/?token=6d81d530b1ffe2413845b87d86a3372c4d9b63f50ad6a2d8

console.ts:134 [Extension Host] Python Extension: [I 22:44:45.845 NotebookApp] 302 GET /?token=6d81d530b1ffe2413845b87d86a3372c4d9b63f50ad6a2d8 (::1) 0.00ms

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rchiodocommented, Nov 15, 2018

Actually the regex doesn’t match 127.0.0.1 either. It assumes localhost:

This is the regex. /http://localhost:[0-9]+/?token=[a-z0-9]+/

0reactions
IanMatthewHuffcommented, Nov 20, 2018

@pauloneves. With this PR: https://github.com/Microsoft/vscode-python/pull/3386 I’ve expanded our address handling. It should now be fine with localhost, IP, missing token values, and base_url values.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't start Python interactive viewer for Jupyter cell #3794
Try to execute cell in imported python notebook. Python interactive doesn't start and freezes. Expected behavior. The selected cell should have ...
Read more >
Working with Jupyter code cells in the Python Interactive window
Work with Jupyter-like code cells; Run code in the Python Interactive Window; View, inspect, and filter variables using the Variables Explorer and Data ......
Read more >
VS Code: Can't run Python Interactive Window - Stack Overflow
I was trying to run the Interactive Window in a brand new Anaconda environment. This means I did not have Jupyter Notebook installed...
Read more >
What to do when things go wrong - The Jupyter Notebook
Jupyter fails to start · Have you installed it? ;-) · If you're using a menu shortcut or Anaconda launcher to...
Read more >
Running Python code with the Jupyter interactive window
The Jupyter interactive window in VS Code lets you work with and run Python code in an interactive, REPL -like environment. You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found