vscode-jupyter: Jupyter interactive cannot use via remote ssh as it showed chunkLoadError

Issue Type: Bug

When I use remote ssh connected to the ubuntu server, I cannot ordinarily open the .ipynb file and cannot open the interactive window when reading the .py file. When I open the .ipynb file, the remote vscode window will reconnect repeatedly. When I open the interactive window on the .py file, the interactive window cannot normally display, with a notion 图片1

I check the Webview developer tools, there are following warnings: 图片2

Extension version: 2020.12.414227025 VS Code version: Code 1.53.0 (8490d3dde47c57ba65ec40dd192d014fd2113496, 2021-02-03T20:36:38.611Z) OS version: Windows_NT x64 10.0.19042 Remote OS version: Linux x64 5.8.0-41-generic

System Info
Item Value
CPUs Intel® Core™ i7-10710U CPU @ 1.10GHz (12 x 1608)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.83GB (7.77GB free)
Process Argv –folder-uri vscode-remote://ssh-remote%2Bfsk-remote/home/bowen/git/coding/python --crash-reporter-id fb7316d2-25cc-4b66-bbff-db82fd1cc005
Screen Reader no
VM 0%
Item Value
Remote SSH: fsk-remote
OS Linux x64 5.8.0-41-generic
CPUs Intel® Xeon® CPU E5-2678 v3 @ 2.50GHz (48 x 3247)
Memory (System) 94.28GB (75.92GB free)
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30211402
pythonvsdeb440:30248342
pythonvsded773:30248341
pythonvspyt875:30251590

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 31 (10 by maintainers)

Most upvoted comments

I have the same problem. I am not using .ipynb files, but simple .py files with code sections (# %%). The .py runs just fine in the remote shell, but shows these strange messages when run in the interactive console.

I have encountered a similar problem in scripts where I do not output anything to sys.stdout.

If I execute the following cell from a .py file via SHIFT+ENTER and then inspect x in the interactive terminal, I receive the aforementioned error.

# %%
import numpy as np

x = np.random.rand(3)
# %%
# [inspect `x` in the interactive terminal] -> error

However, I do not get the error when I have printed something in the script prior to the inspection in the interactive terminal.

# %%
import numpy as np

print("init stdout")
x = np.random.rand(3)
# %%
# [inspect `x` in the interactive terminal] -> no error

Following on the discoveries of @janjagusch @PhilippRuchser

System setup Running VS Code on WSL2. Extension versions are:

  • Jupyter: 2021.5.745244803
  • Python: 2021.4.765268190

Python interpreter is version 3.8.8 installed in an anaconda environment on WSL2 (‘Python 3.8.8 64-bit (‘base’: conda)’)

Workaround

  1. Create a new .py file in the working directory
  2. Add one line with a print statement (e.g. print(“init stdout”) )
  3. Right-click and select Run Current File in Interactive Window

Once the three steps above are complete, I am able to continue using the interactive window and run cells in other files without errors.

Creating and running the file with the print statement: image

Subsequently running other files in the same working directory: image

I have the same problem. I am not using .ipynb files, but simple .py files with code sections (# %%). The .py runs just fine in the remote shell, but shows these strange messages when run in the interactive console.

I have encountered a similar problem in scripts where I do not output anything to sys.stdout.

If I execute the following cell from a .py file via SHIFT+ENTER and then inspect x in the interactive terminal, I receive the aforementioned error.

# %%
import numpy as np

x = np.random.rand(3)
# %%
# [inspect `x` in the interactive terminal] -> error

However, I do not get the error when I have printed something in the script prior to the inspection in the interactive terminal.

# %%
import numpy as np

print("init stdout")
x = np.random.rand(3)
# %%
# [inspect `x` in the interactive terminal] -> no error

This worked for me.

  • Create a Python file that contains a single line print statement
  • In VS Code, run “Jupyter: Run Current File in Interactive Window”
  • Afterwards you can use the interactive window normally

Thanks, @PhilippRuchser!

(Tested with vscode-python=2021.1 and vscode-jupyter=2020.12) (I’m not using the vscode-remote extension. I connect directly to the remote machine using ssh)