vscode-jupyter: Kernel won't start (heartbeat). May be related to use of --system-site-packages when defining virtual environment

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

  1. Open vscode and select python interpreter from virtual environment
  2. Activate virtual env with ipykernel and jupyter library installed from integrated terminal.
  3. Command Pallete > Python > Create New Jupyter Notebook
  4. In first cell type print(‘Hello World’) and execute

Actual behavior

Notification shows - Connecting to IPython kernel: Connecting to kernel… After couple of minutes ‘Timed out waiting to get a heartbeat from kernel process’

Expected behavior

Cell in notebook should get executed correctly.

Your Jupyter and/or Python environment

Please provide as much info as you readily know

  • Jupyter server running: Local
  • Extension version: 2020.8.103604
  • VS Code version: 1.48.2
  • Setting python.jediEnabled: false
  • Setting python.languageServer: None
  • Python and/or Anaconda version: 3.8.5 (No Anaconda)
  • OS: Windows | Mac | Linux (distro): OSX 10.14.6 (MacOS Mojave)
  • Virtual environment: virtualenv

Python Output

mldot-python-debug.log

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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@DonJayamanne I have not had this issue since I upgraded in July. However, I have not been using this feature much because of scalability as well.

@mldot. Glad that you have an environment that you can move forward in for now. The additional info on --system-site-packages is interesting we can try setting up a repro with that parameter to see if we can create this issue ourselves to debug.

@IanMatthewHuff Thanks for the follow-up.

Yes this environment works well with a stand alone jupyter notebook install. When I simply have a python .py file running in this environment in. VSCode it can successfully import the libraries. Also the python prompt works. It is only the vscode jupyter notebook itself that is somehow not able to resolve the environment settings.

Just to provide you with an update I was able to get vscode Jupyter notebook working with a new environment I created this morning. The only change was I didnot use the --system-site-packages setting when invoking virtualenv. The ml_master env was created using this parameter which allowed me access to global packages in the parent repository without having to again duplicate installs. But somehow this setting is not working with the vscode python jupyter notebook. If I do need to run Jupyter notebook with vscode I believe for the time being I can use the new environment I created.