NVIDIA / cuQuantum

Home for cuQuantum Python & NVIDIA cuQuantum SDK C++ samples
https://docs.nvidia.com/cuda/cuquantum/
BSD 3-Clause "New" or "Revised" License
339 stars 64 forks source link

How to run a browser for jupyter notebook in cuQuantum docker environment ? #18

Closed ShashiQubit closed 2 years ago

ShashiQubit commented 2 years ago

Nvidia cuQuantum Following the well designed documentation I was able to successfully get this to run. I am using terminal to write my Quantum experiments.I want to know how to run a jupyter notebook inside docker container. After installing jupyter in docker and running it gives a link that doesn't open in a browser of my linux system.I then installed firefox inside cuQuantum docker but it doesn't launch the browser. Gives a display not found error.How can I run my experiments in jupyter ?

mtjrider commented 2 years ago

After installing jupyter in docker and running it gives a link that doesn't open in a browser of my linux system. I then installed firefox inside cuQuantum docker but it doesn't launch the browser. Gives a display not found error.How can I run my experiments in jupyter ?

Typically, you launch the Docker container and then run the Jupyter server inside the container and access it from the host machine via browser outside of the container.

To do this, you'll need to publish the appropriate port in the container to the host operating systems. Something like this:

docker run -p 8888:8888 ...

Then on the host OS, open a browser and navigate to localhost:8888

There's also a tool called "Jupyter Docker Stacks" that may be relevant.

ShashiQubit commented 2 years ago

@mtjrider running using the "Jupyter Docker Stacks" method doesn't take into account the cuQuantum docker environment. Meaning in notebook I can't import cuquantum or cirq. There is something I am missing and I don't know what. Here is how I am running the command in terminal. $ docker run --gpus all --rm nvcr.io/nvidia/cuquantum-appliance:22.07-cirq and then running $ docker run -p 8888:8888 jupyter/scipy-notebook:0fd03d9356de It launches the notebook but the libraries can't be imported.

ShashiQubit commented 2 years ago

Issue solved ! To run experiments in jupyter I had to execute the following commands: $ docker run --gpus all -it --rm --runtime=nvidia -v "/home/shashi":"/workspace" -p 80:8888 nvcr.io/nvidia/cuquantum-appliance:22.07-cirq /bin/bash And then when inside the container I had to install jupyterlab using: pip3 install jupyterlab And to launch the nootbook : jupyter lab --ip 0.0.0.0 --port 8888 --allow-root Now in the next step when copy and pasting the link in browser I had to change the port from 888 to 80 ex: http://127.0.0.1:8888/lab?token=.... to http://127.0.0.1:80/lab?token=....

@mtjrider Thanks ! for the docker run -p 8888:8888 ... clue