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.

Failure Inspecting Variables from Docker Jupyter Notebook: '_VSCODE_InfoImport' is not defined

See original GitHub issue

Environment data

  • VS Code version: 1.15.1
  • Extension version (available under the Extensions sidebar): - unsure what you mean; none available
  • Jupyter Extension version (available under the Extensions sidebar): v2020.11.372831992
  • OS (Windows | Mac | Linux distro) and version: mac 10.15.7 (19H15) (Catalina)
  • Python and/or Anaconda version: 3.8.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
  • Jupyter server running: Local | Remote | N/A - Local in Docker image

Expected behaviour

Run some code in my Jupyter notebook (using pandas, numpy) Click on “Show variables active in Jupyter kernel” button All variables defined in my Jupyter python code appears Click on “Show variable in data viewer” for any of the variables New tab in VS Code opens displaying all the contents of the panda dataframe variable Note: This works if I select “Default - VS Code will automatically start a server for you on localhost”

Actual behaviour

When I run the same notebook against a Docker image based on jupyter/scipy-notebook, I get this behavior:

  1. Run some code in my Jupyter notebook (using pandas, numpy)
  2. Click on “Show variables active in Jupyter kernel” button
  3. Only 5 variables defined in my Jupyter python code appears in the window; the rest of the variables display as “Loading…” message
  4. Click on “Show variable in data viewer” for any of the variables
  5. New tab in VS Code opens briefly but then closes, displaying an error message " ‘_VSCODE_InfoImport’ is not defined"

Steps to reproduce:

  1. Run Docker image based on jupyter/scipy-notebook
  2. Create new Jupyter notebook in VS Code
  3. Connect to Docker image
  4. Paste in this code block:

import pandas as pd 
data = [['tom', 10], ['nick', 15], ['juli', 14]] 
df = pd.DataFrame(data, columns = ['Name', 'Age']) 
df

  1. Open Output window for Jupyter:

http://127.0.0.1:8888/: Kernel started: 6cc2ad2e-f162-4195-b095-c01b1a587890
http://127.0.0.1:8888/: Creating new notebook 
http://127.0.0.1:8888/: Kernel started: 4cf9f902-4c26-45bf-a012-416193e63312
Error 2020-11-23 11:41:18: Failure during variable extraction:
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-ab305b61bf02> in <module>
----> 1 print(_VSCODE_VariableImport._VSCODE_getVariableInfo(df))

NameError: name '_VSCODE_VariableImport' is not defined

Logs

The logs below use the variable names I created: credentials_df, all_tweets_df. Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

Error 2020-11-23 11:03:59: Failure during variable extraction:
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-9-9b1fd824018c> in <module>
----> 1 print(_VSCODE_VariableImport._VSCODE_getVariableInfo(credentials_df))

NameError: name '_VSCODE_VariableImport' is not defined
rror 2020-11-23 11:34:41: Failure during variable extraction:
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-9-587618beb4a5> in <module>
----> 1 print(_VSCODE_InfoImport._VSCODE_getDataFrameInfo(all_tweets_df))

NameError: name '_VSCODE_InfoImport' is not defined
Error 2020-11-23 11:34:41: [Error: Failure during variable extraction:
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-9-587618beb4a5> in <module>
----> 1 print(_VSCODE_InfoImport._VSCODE_getDataFrameInfo(all_tweets_df))

NameError: name '_VSCODE_InfoImport' is not defined
	at E.extractJupyterResultText (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:49:575871)
	at E.deserializeJupyterResult (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:49:575990)
	at E.getDataFrameInfo (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:49:573972)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async r.ensureInitialized (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:49:216750)
	at async r.getDataFrameInfo (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:49:215836)
	at async E.prepDataFrameInfo (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:49:205181)
	at async E.showData (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:49:204504)
	at async l.create (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:49:214578)
	at async f.showDataViewer (/Users/jerryharris/.vscode/extensions/ms-toolsai.jupyter-2020.11.372831992/out/client/extension.js:32:570651)]

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
IanMatthewHuffcommented, Nov 25, 2020

@jlharri and @joyceerhl No solution yet, but just wanted to note that I was able to set that docker image up locally and I can repro the issue. So I’m investigating on that now.

0reactions
jlharricommented, Dec 4, 2020

Hello, Sorry for the delay. I downloaded the new extension and it works! There is a slight 1-2 second delay when displaying the variables. But all variables are displayed and I can open them up in a separate window. Thanks!!

Jerry [image: image.png]

On Thu, Dec 3, 2020 at 1:31 PM Rich Chiodo notifications@github.com wrote:

Here’s a link to build output from a run on the main branch (hopefully you have access to this):

https://github.com/microsoft/vscode-jupyter/suites/1599679515/artifacts/29160425

That has both Ian’s and my fixes in it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-jupyter/issues/4006#issuecomment-738203083, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIFY4AHK5FQTMCRNX4NJHTSS7KOZANCNFSM4T7XNWAA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failure Inspecting Variables from Docker Jupyter Notebook ...
Run some code in my Jupyter notebook (using pandas, numpy); Click on "Show variables active in Jupyter kernel" button; Only 5 variables defined...
Read more >
How can I solve the variable is not defined error in jupyter ...
Note: this code work fine in Pycharm environment but it doesn't work on jupyter notebook giving me error variable auth is not defined....
Read more >
How to Run Jupyter Notebook on Docker | by Shinichi Okada
The first command above will run the Jupyter minimal-notebook connecting the local directory to a Docker container.
Read more >
Troubleshooting Common Problems - Jupyter Docker Stacks
In the case of the docker-stacks images, you can set the CHOWN_EXTRA and CHOWN_EXTRA_OPTS environment variables. For example, to change the ownership of...
Read more >
Environment Magic with Jupyter and Docker
Jupyter Notebooks and Docker are great tools for quickly getting ... to solve problems, programming is not only a great career option, ...
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