from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.tools.visualization import matplotlib_circuit_drawer as drawer
from qiskit import Aer
from qiskit import execute
import numpy as np
%matplotlib inline

This is the code cell that I am trying to implement. The error is in the second line.

Error--> ImportError: cannot import name 'matplotlib_circuit_drawer'

I'm using Google Colab to execute the code. How to solve this?


1 Answer 1


qiskit.tools.visualization has been moved to qiskit.visualization and matplotlib_circuit_drawer has been removed. Instead of using it, try using qiskit.visualization.circuit_drawer() with the appropriate arguments.

So in this case it should be qiskit.visualization.circuit_drawer(my_circuit, output='mpl', filename='my_circuit.png')


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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