This is a comprehensive guide for setting up your environment on your personal computer for working with Qiskit Textbook. This will help you reproduce the results as you see them on the textbook website. The Qiskit Textbook is written in Jupyter notebooks. Notebooks and the website are the only media in which the Textbook is fully supported.
The Qiskit Textbook provides some tools and widgets specific to the Textbook. This is not part of Qiskit and is available through the
qiskit_textbook package. The quickest way to install this with Pip and Git is through the command:
pip install git+https://github.com/qiskit-community/qiskit-textbook.git#subdirectory=qiskit-textbook-src
Alternatively, you can download the folder qiskit-textbook-src from the Github and run:
pip install ./qiskit-textbook-src
from the directory that contains this folder.
The default backend for
qiskit.visualization.circuit_drawer() is the text backend. However, depending on your local environment you may want to change these defaults to something better suited for your use case. This is done with the user config file. By default the user config file should be located in
~/.qiskit/ and is the
Qiskit Textbook uses default circuit drawer as MatPlotLib. To reproduce visualizations as given in qiskit textbook create a
settings.conf file (usually found in
~/.qiskit/) with contents:
[default] circuit_drawer = mpl
c.InlineBackend.figure_format = 'svg'
You will find a code snippet at the end of the most tutorials which will contain the information on which versions of qiskit packages are used in the tutorial. If you find inconsistency in syntax and/or outputs, try to use the same version.
To check the version installed in your computer, run the following in Python shell or Jupyter Notebook:
import qiskit qiskit.__qiskit_version__