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.

Viewer mode from Docker

See original GitHub issue

I’m attempting to run the bwalter42/jupyter_cadquery:2.2.0 docker image, and connect to it in viewer mode from VS Code. I’ve been attempting to follow along with what’s described in #40 and #42, but I’m having trouble determining what is still necessary now that it seems the docker image has been updated to a version which has the viewer mode built in.

When I exec into the container and run python I get the following error.

~$ pythonPython 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from jupyter_cadquery.viewer.client import show
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'jupyter_cadquery'

Please let me know if there are instructions I missed for starting in viewer mode, and then connecting from my IDE. Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bernhard-42commented, Oct 5, 2021

When working with the docker container, we need to simulate the jcv command since it is not ootb supported:

  1. When you start the docker container also expose the zmq port 5555:

    
    run -it --rm -v $WORKDIR:/home/cq -p 5555:5555 -p 8888:8888 bwalter42/jupyter_cadquery:2.2.0
    
  2. Open http://127.0.0.1:8888/lab in your browser

  3. Create/open a notebook in Jupyter in the browser and run the following code in the first cell:

    from jupyter_cadquery.viewer.server import start_viewer
    start_viewer()
    

    Now you should see the cad viewer with the logo

  4. In your IDE use the show or show_object command. It’ll send the objects to port 5555 of the docker container and show the object in the jupyter cell. Note: There is no need to work in Jupyter, it is only the container for the viewer!

If you have a workdir for the docker command you can reuse this notebook in the next sessions.

The jcv command uses voila (a Jupyter viewer) to automate this for local installations.

0reactions
tgrosingercommented, Oct 8, 2021

Fantastic, I love that I can skip the notebook now and jump right into the model. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview | Docker Documentation
The Images view displays a list of your Docker images and allows you to run an image as a container, pull the latest...
Read more >
Swarm mode overview - Docker Documentation
Use the Docker CLI to create a swarm, deploy application services to a swarm, and manage swarm behavior. Docker Swarm mode is built...
Read more >
Docker daemon configuration overview
The Docker daemon persists all data in a single directory. This tracks everything related to Docker, including containers, images, volumes, service definition, ...
Read more >
Docker Desktop - Docker Documentation
Docker Desktop is an easy-to-install application for your Mac, Linux, or Windows environment that enables you to build and share containerized applications ...
Read more >
View container logs - Docker Documentation
The docker logs command shows information logged by a running container. The docker service logs command shows information logged by all containers ...
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