IBM LinuxONE Community Cloud - Group home

Install IBM Qiskit on LinuxOne Ubuntu

By Jack Woehr posted Fri May 20, 2022 07:31 PM

  

Purpose

Present a recipe for painless installation of IBM Qiskit on a LinuxOne Ubuntu 20.04 installation.

Audience

Anyone interested in using Qiskit from LinuxOne Ubuntu to access quantum computing locally or in the cloud from various providers of access such as IBM, Rigetti, IONQ, etc., who offer access via IBM Qiskit.

Our Goal

IBM Qiskit is the open source project that IBM Quantum established around 2016 to include the quantum computing community in the march forward towards generally useful quantum computing. Install Qiskit on your workstation and you can explore the quantum algorithms on IBM's quantum processing units (QPU) and/or simulators in the cloud, or in the Qiskit Aer simulator locally on your workstation.

The Qiskit code is primarily coded in Python 3, the preëminent scientific research and development computer language of the present era, as this allows the Qiskit Team to leverage the wealth of modules available from the Python Package Index. Qiskit itself is installable from that same package manager via the command pip3 install qiskit[all] ... at least, in theory.

In practice, as Qiskit loads its own dependencies, the package manager attempts to build any missing compiled libraries for your workstation. On various platforms this leads to problems: individual open source components may require modification or special handling to build on a given platform. As these dependent components tend to be very important to developers inside and outside the quantum computing community, your favorite operating system usually can install these components and their Python drivers for you via its own package manager.

As it can be tedious to enter the loop of:
  • pip3 install qiskit[all]
  • installation fails for missing compiled component that pip cannot build
  • read long error message and determine missing component
  • search for component with your package manager
  • install package
  • loop until done
we present a recipe, a series of steps to install Qiskit on a freshly allocated LinuxOne Community Cloud Ubuntu 20.04 virtual server.Feedback WelcomeYour feedback is appreciated. Following successful installation, I culled the following recipe from .bash_history and may possibly have omitted a step. If you encounter trouble following the recipe, let me know and we will correct any errors or omissions.

The Recipe to Install Qiskit on LinuxOne Ubuntu 20.04

This recipe is also found on my Github Quantum Computing page.

# This is, I believe, my recipe for a LinuxOne Ubuntu instance
# as provisioned by the LinuxOne Community Cloud at
# https://linuxone.cloud.marist.edu/#/login
# There may be errors or omissions, let me know.

cd ~
mkdir Qiskit
cd Qiskit
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt install python3-pandas
sudo apt install python3-jupyter
sudo apt install python3-notebook
sudo apt install python3-h5py
sudo apt install python3.8-venv
sudo apt install cmake
sudo apt install ninja-build
sudo apt install python3-scipy
sudo apt install python-numpy
sudo apt install python3.8-dev
sudo apt install lapack
sudo apt install libblas
sudo apt install liblas
sudo apt install liblapack
sudo apt install libblas64-dev
sudo apt install libblas-dev
sudo apt install libopenblas
sudo apt install libopenblas-dev
sudo apt install gfortran
sudo apt install cython3
sudo apt install python3-sklearn
sudo apt install libxml2
sudo apt install libxslt1-dev
python3 -m venv qrel_venv --system-site-packages
. qrel_venv/bin/activate
pip install -U pip
pip install wheel
pip install pep517
pip install qiskit[all]

After installation

The installation takes place in a virtual environment that we create in $HOME/Qiskit as part of the recipe. After installation, source that virtual environment activation script with the command . $HOME/Qiskit/qrel_venv/bin/activate and then the Qiskit components are available to Python. In that command, don't omit the "dot" . because that is the "source" command that causes the environment changes made by the activate script to change the environment of the command session that called it.

Thank you

That is all! Looking forward to hearing from you. Join the Qiskit Slack and find me as the user Jax.

#ibmchampions-highlights-home
#ibmchampions-highlights​​​​
0 comments
221 views