How to Install Qiskit — Programming on Quantum Computers Ep 2

– So let’s get started. – [Paul] That was good, but the screen turned off in the middle of it. – [Grunts comically] – [Paul] All right, let’s do the intro. [Upbeat Music] – [Abe] Hello again. This is Abe and welcome back to Coding with Qiskit. In this episode, we’re
going to install Qiskit on our computer and get
started writing code. Now we’re going to make sure that you’re ready to go
whether you’re using a Mac, a Windows machine, or a Linux machine. So we’re going to achieve two things. The first thing that we’re going to do is first set up Qiskit on our computer and then what we’re going to do is get an access token from
the IBM Quantum Experience. So that access token
allows us to write code that we can then run, not
just locally on our computers but also on real quantum computers at IBM. So in order to install Qiskit, the first thing I’m going to do is make sure that I have all the requirements ready. And to do this, I’m going to install a distribution of Python
called Anaconda Python. Now I’m going to be installing things on a Mac so every time I see a step that requires a little bit of attention, if you’re on Windows or on Linux machines, I’ll point those out. So we start off by opening
a new browser window and typing in: Anaconda Python. This will take us to a distribution page for Anaconda Python which allows me to now install it on my computer. As I said, I’m using a macOS right now but if you’re on a Windows machine or a Linux machine, you’d have to change depending on which
set-up you’d like to use. Now one thing I’d like to point out here, is that if you’re on a Windows machine, what you are downloading is an executable which will then install
Anaconda on your computer. If you’re on a Linux machine, you’re downloading an .sh file. So let’s do the macOS installation. And a key thing to remember here is we’re going to be using Python 3.7. There is another distribution for 2.7 but we’re not going to be using that. So let’s go to the Python 3.7 version and click Download. As you might imagine, the download will take a few moments so this is a good point to pause the video and come back to it once
your download is complete. Once the download is complete, I’m going to go to my Downloads folder and click the Anaconda package. I’m going to click Continue on this step and then follow the
installation instructions. So usually the default
settings are good enough so I’m just going to do this very quickly. And as this installation is proceeding, I would like to remind you again, if you’re on a Windows machine, you would go to your Downloads folder and run the executable for
the Anaconda distribution and if you’re on a Linux machine, you’re going to open your terminal, switch to that folder,
your Downloads folder, and then type: bash, along with the name of the file that you downloaded. As of this video, it was an .sh file. So once the installation completes, I’m going to close and start my terminal. And then install Qiskit by
typing in: pip install qiskit. So this procedure is
the same on all devices. On Windows machine, you would
open the Anaconda Prompt. So go to your Start Menu
and type: Anaconda Prompt. Open that terminal window
and type: pip install qiskit and on a Linux machine, you’d do exactly what we did here which
is open your terminal and type: pip install qiskit so similar instruction on
all three operation systems. All right, and once that’s done, we’re ready to start using Qiskit. So what I’m going to do is use the Jupyter Notebook interface to write Qiskit code so while we’re in this terminal window, what I’m going to do is
type: jupyter notebook. Notice how the spelling of Jupyter has a Y in it. Once I do that, Jupyter
opens in a new browser window and you get something
that looks like this. So the first thing to do, is create a new Jupyter notebook based on Python 3. And this is what the page looks like. So the first thing I’m going to do is make sure that my Qiskit installation is complete. So what I’m going to do is write some Python code
to import Qiskit here. And that’s going to say: import qiskit and hit Shift plus Enter. If you have Qiskit installed, this line should execute
and you should see that line go from In to In 1. And to make sure that
the version of Qiskit is the latest version, I’m going to type:
qiskit.__qiskit_version__ When you do that, you should see an output that tells you the version of Qiskit that you have installed. As of this video, the version of Qiskit that’s the latest is 0.11.1 and the versions that you see under that are the components of Qiskit. The four elements that
we’ll be talking about throughout this video series. Remember that Qiskit
is open source software so what you can do is go to, find the link to our GitHub page, go to the Qiskit repository and scroll down in the ReadMe and see what release version there is. So as you see, this is release 0.11.1 which is exactly what we’re seeing in our Jupyter notebook. So we’re up to date and
we’re ready to start writing code. While we write our code, what we will usually do is first, debug our code on a simulator and once we’re ready to run our code we’ll send it to a quantum device. In order to use the
quantum devices at IBM, we need to get an API token which gives us permission
to use the devices. So to get that API token, we need to create an account on the IBM Quantum Experience website. That website is Once you get to the website, you need to create a new account, if you don’t have an account. Once you log into the IBM
Quantum Experience website, you should be seeing a
page that looks similar to this. So this website allows you to first, create a quantum circuit graphically by using, what we call a circuit composer or to use online Qiskit notebooks by going to the left side and clicking Qiskit Notebooks or by going to the homepage and clicking Create a notebook. So you can think of this as a way of running Jupyter notebooks online with Qiskit installed just like we did on our local computer. In order to get your API token, remember this is your access code to IBM’s quantum devices. You would go to your profile page by clicking this top right bar and clicking My Account. And this is your API token. So it’s hidden from view,
you’d click Copy Token. On the Jupyter notebook,
we’re going to type: from qiskit import IBMQ and hit Shift, Enter to execute that line and then we’re going to
type: IBMQ.save_account and then within single quotes I’m going to type in my API token that I pasted from that website. Once you do this, your API token is saved onto your computer and now you’re ready to
access IBM’s quantum devices. To see that you have
access to these devices, what you can do is then
type: IBMQ.load account. Once this line executes, you should see an output that tells you the account that you have access to and you should be able to proceed with running code, not
just on your computer, but then sending the quantum circuits that you build in your computer to IBM’s quantum devices
and getting results back from them. So now that you’ve installed Qiskit, you’re ready to start writing code and building your quantum circuits and executing them, both on simulators and on quantum hardware. This is the exciting part, where you get to build, not just things to test on your computer, but to deploy in a lab at
IBM and get results back and these could be games. These could be applications for industry or even things you
personally are interested in. We’ll start off in the next episode by showing you how to run
a simple quantum circuit, both on a simulator on your computer and on the hardware at IBM. If at any point, you had
trouble installing Qiskit please feel free to reach out to us on our Qiskit Slack channel where you can get support. Not just from IBM but also from people in the community. We’ll post a link to the Slack channel down in the description. [Upbeat Hip Hop]

38 thoughts on “How to Install Qiskit — Programming on Quantum Computers Ep 2

  1. 1:23 Anaconda download.
    2:59 Anaconda installation command: [bash Anaconda3-]
    3:23 Install Qiskit : [pip install qiskit] (Linux, MacOs,Windows)
    4:05 Run Jupiter Notebook: jupyter notebook.
    4:36 Verify installation :
    4:19 Create a new notebook
    4:42 Check qiskit version : import qiskit | qiskit._qiskit_version [version display]
    5:42 Review available qiskit version on
    6:20 Create Qiskit account and API Token :
    7:21 Set up and save token for Qiskit account : from qiskit import IBMQ "Token"

    If Permission issues
    Install brew :

    mkdir $HOME/.brew && curl -fsSL | tar xz –strip 1 -C $HOME/.brew
    mkdir -p /tmp/.$(whoami)-brew-locks

    mkdir -p $HOME/.brew/var/homebrew

    ln -s /tmp/.$(whoami)-brew-locks $HOME/.brew/var/homebrew/locks

    export PATH="$HOME/.brew/bin:$PATH"

    brew update && brew upgrade .


    Afterwards make sure you add the following lines to your `.zshrc`.
    mkdir -p /tmp/.$(whoami)-brew-locks
    export PATH="$HOME/.brew/bin:$PATH"

  2. thanks a lot
    i am really looking into quantum computing
    interested to do my project in this and you are uploading these videos when i am desperately looking to get some information that could help me to build my project

    Sathwik chowda


    Collecting scipy>=1.0 (from qiskit_terra==0.8.2->qiskit)

    Downloading (30.3MB)

    |███████████████████▌ | 18.4MB 3.7kB/s eta 0:54:06

  4. I have been waiting for such a course for 6 months ,the day since i failed in installing qiskit properly .Please keep going ,your courses are gonna get my postgraduate project done.

  5. Kudos to qiskit team.
    While loading my account through IBMQ.load_account(). I'm getting a error that is RequestsApiError: 401 Client Error: Unauthorized for url: __url__. LOGIN_FAILED. Please help me out with this. I did that on to my jupyter notebook and also through IBM-Q Qiskit Notebooks and still getting the same error.

  6. do I really need anaconda, or can I get around with just Python 3 installed?
    Is it a requirement of qiskit (a newer version of)? Advise please.

  7. ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\users\indhr\anaconda3\lib\site-packages\~cipy\cluster\_hierarchy.cp36-win_amd64.pyd'

    Consider using the `–user` option or check the permissions.i am getting this error, how to overcome??

    i have given the permissions , still it is showing some errors

  8. My Qiskit installation on the Anadacoda shell informed me that there was an environmentalError hence my access was denied. What do I do in this situation?

  9. Hello! there's an installation problem with me , after the command 'import qiskit' , it says "Could not import the Aer provider" and the version of the qiskit says "none" . please help me finding solution to my problem! thank ya !

  10. Sir my windows is not accepting the installation. Each time I am trying to install it is keep repeating that there is some problem. I tried 64 and 32 bit both. What should I do?

  11. I'm anable to save acount of qiskist. When I enter the API token, it shows error, I done it multiple time but same thing happened… Can you help me fix it.. Please..

  12. Hi! Sir. Why you think I get this and how to solve it, since "none" might mean ERROR in Jupyter Notebook. Thank you!

    {'qiskit-terra': '0.11.0',
    'qiskit-aer': None,
    'qiskit-ignis': None,
    'qiskit-ibmq-provider': None,
    'qiskit-aqua': None,
    'qiskit': None}

  13. I get this error on Windows 10
    ModuleNotFoundError Traceback (most recent call last)

    <ipython-input-1-578b7f7e9727> in <module>

    —-> 1 import qiskit

    ModuleNotFoundError: No module named 'qiskit'

  14. Do you think MS can be convinced to clear Anaconda Python to be accessible through the MS store? The OS is the most under attack and it is important to know the distro is certified.

Leave a Reply

Your email address will not be published. Required fields are marked *