When I tried to use the Qiskit textbook module, it threw the following error:

Command was:

from qiskit_textbook.tools import array_to_latex
array_to_latex(final_state, pretext="\\text{Statevector} = ")

Error was:

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-9-fe86c66f7ae0> in <module>
----> 1 from qiskit_textbook.tools import array_to_latex
      2 array_to_latex(final_state, pretext="\\text{Statevector} = ")

ModuleNotFoundError: **No module named 'qiskit_textbook'**

When I looked up the version I had, it showed the following:

{'qiskit-terra': '0.12.0',
 'qiskit-aer': '0.4.1',
 'qiskit-ignis': '0.2.0',
 'qiskit-ibmq-provider': '0.5.0',
 'qiskit-aqua': '0.6.4',
 'qiskit': '0.16.1'}

Can someone help me in resolving the issue?

  • $\begingroup$ pip install git+https://github.com/qiskit-community/qiskit-textbook.git#subdirectory=qiskit-textbook-src $\endgroup$ – Van Peer Jul 15 at 2:56

The qiskit textbook is not a standard module included with qiskit, it has to be installed separately. The repo where it is kept is here. This link explains how to pip install from a git repo, you need to use a slightly different command to normal pip installs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.