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.

Failing to detect ipykernel module

See original GitHub issue

Steps to cause the bug to occur

  1. Right click on script "Run in interactive window.

Actual behavior

Loads forever. Notifys that ipykernel is not installed image

Expected behavior

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: Local
  • Extension version: 2020.01
  • VS Code version: 1.39.2
  • Setting python.jediEnabled: true
  • Python and/or Anaconda version: 3.6
  • OS: Windows
  • Virtual environment: conda

image

Developer Tools Console Output

Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Failed executing an rpc method. Error: Traceback (most recent call last):  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py", line 12, in <module>    for si in server_list:  File "C:\ProgramData\CooperConda\lib\site-packages\notebook\notebookapp.py", line 1888, in list_running_servers    with io.open(os.path.join(runtime_dir, file_name), encoding='utf-8') as f:FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\skmeenak\\AppData\\Roaming\\jupyter\\runtime\\nbserver-15404.json'During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\daemon\daemon_python.py", line 54, in _decorator    return func(self, *args, **kwargs)  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\daemon\daemon_python.py", line 133, in m_exec_file    return self._execute_and_capture_output(exec_file)  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\daemon\daemon_python.py", line 104, in _execute_and_capture_output    func()  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\daemon\daemon_python.py", line 130, in exec_file    runpy.run_path(file_name, globals())  File "C:\ProgramData\CooperConda\lib\runpy.py", line 263, in run_path    pkg_name=pkg_name, script_name=fname)  File "C:\ProgramData\CooperConda\lib\runpy.py", line 96, in _run_module_code    mod_name, mod_spec, pkg_name, script_name)  File "C:\ProgramData\CooperConda\lib\runpy.py", line 85, in _run_code    exec(code, run_globals)  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py", line 29, in <module>    result = subprocess.run(['jupyter', 'notebook', 'list', '--jsonlist'], capture_output=True)  File "C:\ProgramData\CooperConda\lib\subprocess.py", line 423, in run    with Popen(*popenargs, **kwargs) as process:TypeError: __init__() got an unexpected keyword argument 'capture_output'
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Cached data exists ActivatedEnvironmentVariables, <No Resource>
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: getActivatedEnvironmentVariables, Class name = b, completed in 1ms, Arg 1: undefined, Arg 2: undefined, Arg 3: true
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: [I 15:33:43.277 NotebookApp] JupyterLab extension loaded from C:\ProgramData\CooperConda\lib\site-packages\jupyterlab[I 15:33:43.278 NotebookApp] JupyterLab application directory is C:\ProgramData\CooperConda\share\jupyter\lab[I 15:33:43.280 NotebookApp] Serving notebooks from local directory: C:\Users\skmeenak\AppData\Local\Temp\10fdc1fc-a08f-4b42-a595-509969ab45b6[I 15:33:43.280 NotebookApp] The Jupyter Notebook is running at:[I 15:33:43.281 NotebookApp] http://localhost:8888/?token=74dea3721d973d3161da3c20162c4941be761ebf0b05c4f8[I 15:33:43.281 NotebookApp]  or http://127.0.0.1:8888/?token=74dea3721d973d3161da3c20162c4941be761ebf0b05c4f8[I 15:33:43.281 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).[C 15:33:43.287 NotebookApp]         To access the notebook, open this file in a browser:        file:///C:/Users/skmeenak/AppData/Roaming/jupyter/runtime/nbserver-11364-open.html    Or copy and paste one of these URLs:        http://localhost:8888/?token=74dea3721d973d3161da3c20162c4941be761ebf0b05c4f8     or http://127.0.0.1:8888/?token=74dea3721d973d3161da3c20162c4941be761ebf0b05c4f8
console.ts:137 [Extension Host] Warn Python Extension: 2020-01-13 15:33:43: Falling back to Python Execution Service due to failure in daemon { Error: Failed to execute using the daemon, Traceback (most recent call last):  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py", line 12, in <module>    for si in server_list:  File "C:\ProgramData\CooperConda\lib\site-packages\notebook\notebookapp.py", line 1888, in list_running_servers    with io.open(os.path.join(runtime_dir, file_name), encoding='utf-8') as f:FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\skmeenak\\AppData\\Roaming\\jupyter\\runtime\\nbserver-15404.json'During handling of the above exception, another exception occurred:Traceback (most recent call last):  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\daemon\daemon_python.py", line 54, in _decorator    return func(self, *args, **kwargs)  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\daemon\daemon_python.py", line 133, in m_exec_file    return self._execute_and_capture_output(exec_file)  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\daemon\daemon_python.py", line 104, in _execute_and_capture_output    func()  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\daemon\daemon_python.py", line 130, in exec_file    runpy.run_path(file_name, globals())  File "C:\ProgramData\CooperConda\lib\runpy.py", line 263, in run_path    pkg_name=pkg_name, script_name=fname)  File "C:\ProgramData\CooperConda\lib\runpy.py", line 96, in _run_module_code    mod_name, mod_spec, pkg_name, script_name)  File "C:\ProgramData\CooperConda\lib\runpy.py", line 85, in _run_code    exec(code, run_globals)  File "c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py", line 29, in <module>    result = subprocess.run(['jupyter', 'notebook', 'list', '--jsonlist'], capture_output=True)  File "C:\ProgramData\CooperConda\lib\subprocess.py", line 423, in run    with Popen(*popenargs, **kwargs) as process:TypeError: __init__() got an unexpected keyword argument 'capture_output'    at t.PythonDaemonExecutionService.processResponse (c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\src\client\common\process\pythonDaemon.ts:214:1)    at t.PythonDaemonExecutionService.processResponse [as execFileWithDaemon] (c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\src\client\common\process\pythonDaemon.ts:229:1)  message:   'Failed to execute using the daemon, Traceback (most recent call last):\n  File "c:\\Users\\skmeenak\\.vscode\\extensions\\ms-python.python-2020.1.58038\\pythonFiles\\datascience\\getServerInfo.py", line 12, in <module>\n    for si in server_list:\n  File "C:\\ProgramData\\CooperConda\\lib\\site-packages\\notebook\\notebookapp.py", line 1888, in list_running_servers\n    with io.open(os.path.join(runtime_dir, file_name), encoding=\'utf-8\') as f:\nFileNotFoundError: [Errno 2] No such file or directory: \'C:\\\\Users\\\\skmeenak\\\\AppData\\\\Roaming\\\\jupyter\\\\runtime\\\\nbserver-15404.json\'\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File "c:\\Users\\skmeenak\\.vscode\\extensions\\ms-python.python-2020.1.58038\\pythonFiles\\datascience\\daemon\\daemon_python.py", line 54, in _decorator\n    return func(self, *args, **kwargs)\n  File "c:\\Users\\skmeenak\\.vscode\\extensions\\ms-python.python-2020.1.58038\\pythonFiles\\datascience\\daemon\\daemon_python.py", line 133, in m_exec_file\n    return self._execute_and_capture_output(exec_file)\n  File "c:\\Users\\skmeenak\\.vscode\\extensions\\ms-python.python-2020.1.58038\\pythonFiles\\datascience\\daemon\\daemon_python.py", line 104, in _execute_and_capture_output\n    func()\n  File "c:\\Users\\skmeenak\\.vscode\\extensions\\ms-python.python-2020.1.58038\\pythonFiles\\datascience\\daemon\\daemon_python.py", line 130, in exec_file\n    runpy.run_path(file_name, globals())\n  File "C:\\ProgramData\\CooperConda\\lib\\runpy.py", line 263, in run_path\n    pkg_name=pkg_name, script_name=fname)\n  File "C:\\ProgramData\\CooperConda\\lib\\runpy.py", line 96, in _run_module_code\n    mod_name, mod_spec, pkg_name, script_name)\n  File "C:\\ProgramData\\CooperConda\\lib\\runpy.py", line 85, in _run_code\n    exec(code, run_globals)\n  File "c:\\Users\\skmeenak\\.vscode\\extensions\\ms-python.python-2020.1.58038\\pythonFiles\\datascience\\getServerInfo.py", line 29, in <module>\n    result = subprocess.run([\'jupyter\', \'notebook\', \'list\', \'--jsonlist\'], capture_output=True)\n  File "C:\\ProgramData\\CooperConda\\lib\\subprocess.py", line 423, in run\n    with Popen(*popenargs, **kwargs) as process:\nTypeError: __init__() got an unexpected keyword argument \'capture_output\'\n' }
t.log @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:398
_invokeHandler @ rpcProtocol.ts:383
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:580
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
_socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:592
fire @ event.ts:580
acceptChunk @ ipc.net.ts:239
_register._socket.onData.e @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: > C:\ProgramData\CooperConda\python.exe c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: pinged with hello
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: > C:\ProgramData\CooperConda\python.exe (daemon) c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Exec file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py with args []
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: execute file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: pinged with hello
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: > C:\ProgramData\CooperConda\python.exe (daemon) c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Exec file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py with args []
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: execute file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: pinged with hello
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: > C:\ProgramData\CooperConda\python.exe (daemon) c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Exec file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py with args []
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: execute file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: pinged with hello
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: > C:\ProgramData\CooperConda\python.exe (daemon) c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Exec file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py with args []
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: execute file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: pinged with hello
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: > C:\ProgramData\CooperConda\python.exe (daemon) c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method exec_file
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Exec file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py with args []
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: execute file c:\Users\skmeenak\.vscode\extensions\ms-python.python-2020.1.58038\pythonFiles\datascience\getServerInfo.py
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: Execute rpc method ping
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:43: Python Daemon: pinged with hello
notificationsAlerts.ts:40 Data Science library ipykernel is not installed. Install?
onDidNotificationChange @ notificationsAlerts.ts:40
_register.model.onDidNotificationChange.e @ notificationsAlerts.ts:26
fire @ event.ts:580
addNotification @ notifications.ts:156
notify @ notificationService.ts:100
r @ mainThreadMessageService.ts:83
_showMessage @ mainThreadMessageService.ts:44
$showMessage @ mainThreadMessageService.ts:38
_doInvokeHandler @ rpcProtocol.ts:398
_invokeHandler @ rpcProtocol.ts:383
_receiveRequest @ rpcProtocol.ts:299
_receiveOneMessage @ rpcProtocol.ts:226
_protocol.onMessage.e @ rpcProtocol.ts:101
fire @ event.ts:580
fire @ ipc.net.ts:453
_receiveMessage @ ipc.net.ts:733
_socketDisposables.push._socketReader.onMessage.e @ ipc.net.ts:592
fire @ event.ts:580
acceptChunk @ ipc.net.ts:239
_register._socket.onData.e @ ipc.net.ts:200
t @ ipc.net.ts:28
emit @ events.js:182
addChunk @ _stream_readable.js:283
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onStreamRead @ internal/stream_base_commons.js:94
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:45: Python Daemon: Execute rpc method ping in DS Daemon
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:45: Python Daemon: Execute rpc method ping
console.ts:137 [Extension Host] Info Python Extension: 2020-01-13 15:33:45: Python Daemon: pinged with hello

Also it appears to be intermittent…at lease on one occasion today the user reported and showed me that it did “Work” and the ipython kernel was started. I couldn’t tell whether it was daemon or fallback.

Let me know if you need any more details.

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:43 (17 by maintainers)

github_iconTop GitHub Comments

4reactions
y2kbuggercommented, Jan 13, 2020

Ok I took control of the users computer and did some more exploring. I can now reproduce the “spinning forever” and the action which causes it to be “magically fixed”.

  1. Do a clean restart of VS Code
  2. Run the current script in interactive terminal: image
  3. The ipykernel message will appear. image
  4. The status says “Starting jupter server” indefinitely image
  5. and the Python Interactive window looks like this with the loading animation indefinitely: image

Here’s the clue and source of intermittent behaviour: Everything gets unblocked when I click the x on the notification message which misidentified that ipykernel was not installed. If I had done step 2 multiple times they had been queued and the script will run multiple times.

2reactions
brando90commented, Jan 22, 2020

@DonJayamanne seems that after I removed the conda command from my .bashrc it started working (I actually tried that right away). Weird, I am not using bash as a shell anymore (in mac os Catalina) so I don’t understand why that is affecting VS code (in fact, I don’t understand why my .bashrc file is even being ran).

Somehow removing all errors makes the jupyter notebook work, but I don’t think this is the intended way to have this work for the user, right? Why did I have to go through this if conda was working for my zsh and I am not using bash anymore. Is this a bug with VS code?

From a user’s perspective I expected it to work out of the box but it didn’t…is what Im trying to say.

Read more comments on GitHub >

github_iconTop Results From Across the Web

vscode not detecting ipykernel, verified it is actually installed
Jupyter notebooks fail to launch every time I try to create a new one. It says that ipykernel is not installed, and if...
Read more >
Installing the IPython kernel — IPython 8.7.0 documentation
The IPython kernel is the Python execution backend for Jupyter. The Jupyter Notebook and other frontends automatically ensure that the IPython kernel is ......
Read more >
Fixing Module Not Found errors with Jupyter notebook
If you're getting ModuleNotFoundError in Jupyter, first double-check that you installed the package with pip install . Triple-check you didn't misspell the ...
Read more >
Solved: Jupyter support installation failed - Dataiku Community
log) it is showing that (No module named ipykernel). Please let me know what might be causing the issue? Any Suggestions?? Operating system...
Read more >
How to fix Kernel Error or broken Python in Jupyter Notebook
SHORT VERSION: the commands you'll want are: python -m pip install ipykernel python -m ipykernel install —user References: ...
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