6

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?

glS
  • 27,510
  • 7
  • 37
  • 125
user1936752
  • 3,311
  • 1
  • 9
  • 24

3 Answers3

7

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

met927
  • 3,251
  • 1
  • 10
  • 22
Jonathan Trousdale
  • 3,452
  • 9
  • 20
4

Use the command ls -alt in Terminal on macOS to find hidden files. It's there. This should work for all Mac users.

Glorfindel
  • 628
  • 1
  • 9
  • 24
Lizzo
  • 319
  • 4
  • 10
1

I am still unable to see the ~/.qiskit/settings.conf file. Did the listing to show hidden files as well as created a new conda environment for a new qiskit environment.

I am on a mac and following the instructions listed here: https://qiskit.org/textbook/ch-prerequisites/setting-the-environment.html

acingmath
  • 11
  • 1