-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it clearer guides use notebook environment #2669
Comments
Hi @OmegaTwiddle, how are you running the code examples? I've seen this confusion before when users run code examples in a Python script: Our documentation is written in Jupyter notebooks. In notebooks, the output of the last line of a cell is displayed right after the cell. In the case of I do wonder if there's a way we can make this clearer to users though. EDIT: I've since realised we do have a comment about that in the same code cell: # Return a drawing of the circuit using MatPlotLib ("mpl"). This is the
# last line of the cell, so the drawing appears in the cell output.
# Remove the "mpl" argument to get a text drawing. Do you remember if you saw this comment? I'm wondering how we could make it clearer to future readers. |
I see. Yeah I am using a standalone script on my machine, and running via python from the command line. I did read and try the suggestion in the comment. Even removing the argument didn't draw a text drawing to the screen, so the comment isn't accurate for those running it as a script. It may depend on your user base (perhaps very few people are running scripts), but I find them easier to setup than Jupyter notebooks. I might recomment updating the language that says "It is recommended that you use the Jupyter development environment to interact with quantum computers." to something more like "This tutorial is designed for Jupyter development experience, etc etc". When I read the first statement, since I was running locally (and not interacting with quantum computers yet), I didn't think it applied to me. Anyways, maybe time to follow suit with the Jupyter setup :) Thanks for your consideration! |
That makes sense, I think we can do a couple of things:
# Return a drawing of the circuit using MatPlotLib ("mpl"). These guides are
# written using Jupyter notebooks, which display the output of the last line
# of each cell. If you're running this in a script, use `print(qc.draw())` to
# print a text drawing.
|
URL to the relevant documentation
I'm following the tutorial at https://docs.quantum.ibm.com/guides/hello-world
If I follow Step 1 line for line, my script just exits without printing or displaying anything.
Select all that apply
Describe the fix.
I needed to add the below code to get it to show anything (this wasn't obvious to me).
The text was updated successfully, but these errors were encountered: