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.

Python Launcher does not work for Python terminal or Python Interactive window

See original GitHub issue

Environment data

  • VS Code version: 1.31.0
  • Extension version (available under the Extensions sidebar): 2019.1.0
  • OS and version: Windows 7 Enterprise SP1, 64-bit
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.2 32-bit & Python 2.7.14 64-bit
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
  • Relevant/affected Python packages and their versions: (Python 3) jupyter-notebook 5.7.4; (Python 2) jupyter-notebook 5.2.2

Expected behaviour

Clicking “Run-Cell” above a note-book enabled snippet starts and runs Jupyter Notebook

Actual behaviour

Clicking “Run-Cell” triggers an error stating “Executing code failed : Error: Running cells requires Jupyter notebooks to be installed.”

Running py -m notebook from a cmd window and/or VSCode’s terminal starts jupyter notebook as expected for Python 3 and similarly py -2 -m notebook for Python 2.

Steps to reproduce:

  1. Have at least Python 3 (for the launcher) installed using default options (Python Launcher on PATH, Python Executable not on PATH) and with jupyter-notebook module installed. Have no other versions of Python on PATH, only the launcher (C:\Windows\py.exe)
  2. Select Python 3.x as interpreter.
  3. Create a simple notebook snippet and try to run the cells
#%%
msg = "Hello World"
print(msg)

Logs

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

Starting Jedi Python language engine.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

console.ts:134 [Extension Host] Python Extension: Cached data exists ActivatedEnvironmentVariables, <No Resource>

console.ts:134 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, <No Resource>

console.ts:134 [Extension Host] Python Extension: getActivatedEnvironmentVariables, Class name = S, Arg 1: undefined, Arg 2: {"architecture":2,"path":"C:\\Python37-32\\python.exe","version":{"raw":"3.7.2-final","major":3,"minor":7,"patch":2,"prerelease":["final"],"build":[],"version":"3.7.2-final"},"sysPrefix":"C:\\Python37-32","fileHash":"d84cbeced9380942287d24afb8ff1ca2b1eb881dd92e80f1e21a101cdf2c4f2aa28a2629baad07c6dbd1528b0bc445f6d2a52c9cd30baf402a76b89c82ecdd0b","companyDisplayName":"Python Software Foundation","type":"Unknown","displayName":"Python 3.7.2 32-bit"}

console.ts:134 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, <No Resource>

console.ts:134 [Extension Host] Python Extension: Activation Commands received undefined

console.ts:134 [Extension Host] Python Extension: getActivatedEnvironmentVariables, Class name = S, Arg 1: undefined, Arg 2: {"architecture":3,"path":"C:\\Python27\\python.exe","version":{"raw":"2.7.14-final","major":2,"minor":7,"patch":14,"prerelease":["final"],"build":[],"version":"2.7.14-final"},"sysPrefix":"C:\\Python27","fileHash":"45320b6ecc01ba85d63e7b3a68c02dfe545da607d62447b640dab7cdc589e0b7f087fd3a5b48c27eb06c6b9a9bda6a2326bf1e62e8b4c2d83f1ea190ec714a12","companyDisplayName":"Python Software Foundation","type":"Unknown","displayName":"Python 2.7.14 64-bit"}

console.ts:134 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, <No Resource>

console.ts:134 [Extension Host] Python Extension: Error: Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2
 for C:\Python27\python.exe
t.log @ console.ts:134
e.$logExtensionHostMessage @ mainThreadConsole.ts:39
t._doInvokeHandler @ rpcProtocol.ts:390
t._invokeHandler @ rpcProtocol.ts:375
t._receiveRequest @ rpcProtocol.ts:295
t._receiveOneMessage @ rpcProtocol.ts:225
(anonymous) @ rpcProtocol.ts:100
e.fire @ event.ts:567
s @ ipc.net.ts:295
(anonymous) @ ipc.net.ts:302
e.fire @ event.ts:567
a @ ipc.net.ts:103
_socketDataListener @ ipc.net.ts:132
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636

console.ts:134 [Extension Host] Python Extension: Error: Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2
 for C:\Python37-32\python.exe
t.log @ console.ts:134
e.$logExtensionHostMessage @ mainThreadConsole.ts:39
t._doInvokeHandler @ rpcProtocol.ts:390
t._invokeHandler @ rpcProtocol.ts:375
t._receiveRequest @ rpcProtocol.ts:295
t._receiveOneMessage @ rpcProtocol.ts:225
(anonymous) @ rpcProtocol.ts:100
e.fire @ event.ts:567
s @ ipc.net.ts:295
(anonymous) @ ipc.net.ts:302
e.fire @ event.ts:567
a @ ipc.net.ts:103
_socketDataListener @ ipc.net.ts:132
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636

console.ts:134 [Extension Host] Python Extension: Error: spawn jupyter ENOENT
t.log @ console.ts:134
e.$logExtensionHostMessage @ mainThreadConsole.ts:39
t._doInvokeHandler @ rpcProtocol.ts:390
t._invokeHandler @ rpcProtocol.ts:375
t._receiveRequest @ rpcProtocol.ts:295
t._receiveOneMessage @ rpcProtocol.ts:225
(anonymous) @ rpcProtocol.ts:100
e.fire @ event.ts:567
s @ ipc.net.ts:295
(anonymous) @ ipc.net.ts:302
e.fire @ event.ts:567
a @ ipc.net.ts:103
_socketDataListener @ ipc.net.ts:132
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636

notificationsAlerts.ts:40 Executing code failed : Error: Running cells requires Jupyter notebooks to be installed.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bcoovcommented, Apr 5, 2019

@IanMatthewHuff Apologies for the delay. Finally got a chance to test out the 2019.3.6139 merged fix - everything looks good on my end! 😄

1reaction
bcoovcommented, Mar 20, 2019

Thanks for the update @IanMatthewHuff! I added the Scripts directory to my PATH to try the workaround you suggested. After restarting VSCode and trying to run the cell, it sat there reporting “Starting Jupyter Server” indefinitely. However, after another restart, running the cell again started up the server instance and ran as expected.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Launcher does not work for Python terminal ... - GitHub
Have no other versions of Python on PATH, only the launcher (C:\Windows\py.exe); Select Python 3.x as interpreter. Create a simple notebook ...
Read more >
4. Using Python on Windows — Python 3.11.1 documentation
This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows. Unlike most Unix...
Read more >
How to use Python's py launcher for Windows - InfoWorld
Install the py launcher · Run Python scripts with the py launcher · Set the default Python for py launcher.
Read more >
py launcher does not find my Python 2.7 - Stack Overflow
When I open the cmd terminal and type py -2 , I get this error message: Requested Python version (2) not installed ....
Read more >
How to Run Python Programs ( .py files ) in Windows 10
In this tutorial you will learn How to run Python Programs ( . py files ) on windows 10 computer.We can use Python...
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