jupyter-cadquery icon indicating copy to clipboard operation
jupyter-cadquery copied to clipboard

Problems with "show" in VS Code / Jupyter-Notebook

Open christianhauschel opened this issue 2 years ago • 5 comments

show(obj) works fine in VS Code with Jupyter-Notebook extension for a certain number of executions.

After a while, the show command does not display any graphics anymore. I have tried changing the "presentation" options in VS Code, without success.

Do you know what the problem could be?

christianhauschel avatar May 11 '22 15:05 christianhauschel

image

christianhauschel avatar May 11 '22 16:05 christianhauschel

Restarting the Jupyter kernel does not help... I have to restart VS Code...

christianhauschel avatar May 11 '22 16:05 christianhauschel

@christianhauschel I tried to reproduce with the latest VS Code flipping between two different models continuously. Sometimes the communication gets slow, but it worked all the time. Do you have a notebook where you can reproduce it?

bernhard-42 avatar May 15 '22 17:05 bernhard-42

Can confirm I am having the issue on the latest version of Visual Studio Code, Cadquery, jupyter-cadquery, and Python extension image

Tried running in both ipynb and py formats. Also tried reinstalling ipykernel without any changes

Code

from jupyter_cadquery import set_defaults, open_viewer
set_defaults(theme="dark")
open_viewer("CadQuery")
Python 3.9.12
conda 4.13.0
jupyter-cadquery-3.0.0
Visual Studio Code Version: 1.68.1

Here is my vscode docker devcontainer if that helps with repro

FROM mcr.microsoft.com/vscode/devcontainers/miniconda:0-3

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
# RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

# Copy environment.yml (if found) to a temp location so we update the environment. Also
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
RUN if [ -f "/tmp/conda-tmp/environment.yml" ]; then umask 0002 && /opt/conda/bin/conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
  && rm -rf /tmp/conda-tmp


RUN apt-get update -y && \
  apt-get clean && \
  rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN conda install -c conda-forge -c cadquery cadquery=master && \
  conda clean -a -y

afshawnlotfi avatar Jun 17 '22 08:06 afshawnlotfi

@christianhauschel @afshawnlotfi Now I better understand the issue. I wasn't aware of ˋipywidgetsˋ being supported by VS Code in the meantime. I can reproduce your error now, however, it seems to lie in the ˋipywidgetsˋ implementation of VS Code.

I have no idea how to track that down at the moment and unfortunately need to flag direct support via notebooks in VS Code as currently not supported. You might want to look at the viewer approach of Jupyter-CadQuery

bernhard-42 avatar Jun 19 '22 10:06 bernhard-42