2
$\begingroup$

I'm trying to follow the instructions here https://qiskit.org/documentation/getting_started.html. It says

The default backend for qiskit.visualization.circuit_drawer() or QuantumCircuit.draw() 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/settings.conf and is a .ini file.

I don't see this config file anywhere. Can anyone tell me how I can find the location of this file in order to make the change from the text based plotter to the nicer plotter?

$\endgroup$
2
$\begingroup$

If you are working in Windows, the default location should be C:\Users\[user]\.qiskit, which might be hidden by default. Create a text file in that folder named settings.conf and set it up how you like.

For example by default

from qiskit import *
qc = QuantumCircuit(2)
qc.h(0)
qc.x(1)
qc.draw()

produces

text drawer circuit output

With settings.conf in the folder referenced above, containing the two lines

[default]
circuit_drawer=mpl

the same code produces

mpl drawer circuit output

$\endgroup$
  • $\begingroup$ Thank you very much. And since I will be using this on a Mac as well, can I ask where this file should be in a Mac? $\endgroup$ – user1936752 Nov 6 at 22:42
  • 1
    $\begingroup$ @user1936752 Sorry, I've never worked with qiskit in iOS. However, if you have your API token stored locally, you should have a file named qiskitrc in this folder already. Try doing a search for that file. $\endgroup$ – ChainedSymmetry Nov 6 at 22:47
  • 1
    $\begingroup$ @user1936752 Is it not just Users/[user]/.qiskit? If not a search for .qiskit should lead you there as well. $\endgroup$ – ChainedSymmetry Nov 6 at 23:41
  • $\begingroup$ Thank you - you were indeed correct. However it may be worth adding to your answer that this folder might be hidden! It was for me, hence the trouble finding it $\endgroup$ – user1936752 Nov 7 at 12:01
  • 1
    $\begingroup$ @user1936752 No problem! It's in there, first sentence. $\endgroup$ – ChainedSymmetry Nov 7 at 12:29

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.