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
  • 24,708
  • 5
  • 34
  • 108
user1936752
  • 2,859
  • 1
  • 8
  • 20

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
  • 9
  • 22
Jonathan Trousdale
  • 3,392
  • 8
  • 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
  • 620
  • 1
  • 9
  • 24
Lizzo
  • 309
  • 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
  • Hi and welcome to Quantum Computing SE. When you have enough reputation, please add posts like yours as Comment. – Martin Vesely Nov 28 '20 at 07:35
  • Did you first navigate to the directory using the command: cd ~/.qiskit/ and then use the command ls -alt ? Also, how did you install python Conda? I recently ran into an issue of not having PIP installed, which is why I ask how you installed. Make sure pip is installed using: "pip --version". If it's not installed you can do so using "sudo easy_install pip" PIP is just a helpful tool to download python packages. See link: https://www.w3schools.com/python/python_pip.asp ... You can use terminal command to search for files..., but there are several files to be search... – Lizzo Nov 28 '20 at 21:12