I have installed a Python 3.7.2, download anaconda and visual studio code. Install Qiskit SDK 0.5.3. But when I launch my first test program from https://github.com/Qiskit/qiskit-terra I received a couple of messages like

"message": "Instance of 'QuantumCircuit' has no 'h' member",
"message": "Instance of 'QuantumCircuit' has no 'cx' member",
"message": "Instance of 'QuantumCircuit' has no 'measure' member",

What I do wrong?

This is my code:

from qiskit import *
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q, c)
qc.cx(q[0], q[1])
qc.measure(q, c)
backend_sim = BasicAer.get_backend('qasm_simulator')
result = execute(qc, backend_sim).result()

2 Answers 2


These messages pop up in the linter due to the way gates are dynamically added as circuit attributes in Qiskit Terra. They can safely be ignored. In a future update of Terra these warnings will disappear.


The problem was at linter.

It's necessary to add

 "python.linting.pylintArgs": [

to the settings.json.

  • 1
    $\begingroup$ disabling linting is not necessarily a good idea, as you also lose potentially useful messages. If the linting is not detecting the methods of qc it might be because the shell used by vscode in the background is not using the python distribution/environment in which qiskit is installed $\endgroup$
    – glS
    Mar 15, 2019 at 10:55

Your Answer

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

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