Using Problem Inspector in VS Code
I am trying to use problem inspector in VS Code. When I run the command :
dwave.inspector.show(response)
the cell keeps running and I don't see any pop up displaying the details of the solution.
This is an image that illustrates the problem :
Notice the command written in line 56 and the continuous execution of this cell (without any result) is shown on the right half.
Please help.
Comments
Prakash,
I had never used the inspector on my desktop (always in the Leap cloud instance), so I tried it on my own machine. This is what I learned along the way.
Even though the code ran up the to point where I had the dwave.inspector.show(response) without errors, I did encounter an error message about needing to install the inspector tool. I had just assumed that it was already included in my setup.
Following the instructions at https://docs.ocean.dwavesys.com/projects/inspector/en/latest/installation.html , I used the "dwave install inspector" command and I was able to inspect the problem locally.
If you already had dwave inspector installed, when the dwave.inspector.show(response) code is executed on your machine, did a browser window pop up? The inspector uses a local http server to allow rendering its output in a browser window.
Hope this helps.
Ed, thanks for taking the time to help.
No. The browser didn't pop up. The cell in which I use the command :
runs continuously, without rendering any result.
And, I had installed the inspector tool by following the same instructions.
I am doing this in VS Code. Are you using the same ?
I am using VS code to run this, but I am using the Run Python File in Terminal option. When I use this option, it runs fine on my machine.
Which option are you using to execute your code? I see the interactive window in your screenshot, but do not know how to reproduce that on my end.
I tried from the terminal and got an error :
To get the interactive python window, start writing your code with '# %%'. It will create a code cell, similar to what we get in Jupyter notebooks.
Prakash,
When I tried to run it as a cell, I also received various errors. Some were from the firewall (which I don't plan to change) and others dealt with undefined variables.
I am out of ideas for what you should try next. Hopefully, someone else can help.
Good luck.
Ed
Hi Prakash,
Currently, the problem inspector does not work in Jupyter notebook. As Ed mentioned, the output from the problem inspector opens up in a browser window. We have created a GitHub issue to enable support for Jupyter notebook by displaying output inline: https://github.com/dwavesystems/dwave-inspector/issues/109.
In the meantime, for a simpler code, you can run dwave.inspector.show(sample) in the same cell as the rest of the code and it gives you the local server link with the output from the inspector.
Here is an example
For the error you noticed while using terminal, it looks like it is related to VS Code environment setup. This link might be helpful to debug: https://superuser.com/questions/1602401/vscode-terminal-behaves-strangely-when-opening-a-project-that-is-inside-wsl2.
Hi Tanvi,
Thanks a lot for creating the issue and helping me out. Its working now.
Please sign in to leave a comment.