TransWikia.com

Updating qiskit doesn't update qiskit version using jupyter notebook/terminal

Quantum Computing Asked by Hassan Afridi on January 12, 2021

I installed qiskit using qiskit documents from here https://qiskit.org/documentation/install.html. When I first installed qiskit the version was 0.12.xx on ubuntu with python installed. Everything was working great.

yesterday I needed qiskit version 0.19.6 for "IBM Advocate Test". When I run qiskit.__qiskit_version__
it shows

{'qiskit-terra': '0.xx.xx',
 'qiskit-aer': '0.x.x',
 'qiskit-ignis': '0.x.x',
 'qiskit-ibmq-provider': '0.x.x',
 'qiskit-aqua': '0.x.x',
 'qiskit': '0.12.xx'}

Then I run some commands that were in the test file so everyone trying to give the test have updated qiskit version.
Commands are:

!pip install --upgrade qiskit==0.19.6 
!pip install --upgrade metakernel
!pip install --upgrade portalocker
!pip install --upgrade matplotlib

So after running them there were some sort of errors I don’t remember, then I seek on internet and found something useful here

Updating qiskit doesn't update qiskit version from Spyder

But Qiskit just updated to version 0.13.xx. I have tried this Q&A but didn’t work for me. I rebooted the kernel, restarted pc after running every aspect of command, tried on jupyter notebook and terminal.

Plz help me for what else needs to be done.

2 Answers

The best way to not mix different versions is to use python virtual environments. If you are using python 3.3 or newer then you can easily do it as follows:

cd /path/to/qiskit/advocate/folder
python3 -m venv /path/to/new/venv 

Replace the path in the above code with the appropriate path. Once that is done then you can use pip install qiskit==0.19.6. This is if you are accessing the shell via a terminal. If you are doing it from a jupyter notebook, then add ! in front of all these commands.

Also version 0.13.xx is lower than 0.19.6. So it would seem that somehow you have downgraded qiskit.

Answered by e-eight on January 12, 2021

I accidentally encountered the solution. Sorry I didn't tried your solution butwe have a solution. So

  1. you need to make sure that you have updated python version.

  2. run this command conda info --env to check your conda environments it should look like this

    # conda environments:
    #
    base                  *  /home/alrazi/anaconda3
    python3-env              /home/alrazi/anaconda3/envs/python3-env
    

Now the Solution is simple and it works fine on different issues like I have

"Collecting qiskit Cache entry deserialization failed, entry ignored Could not find a version that satisfies the requirement qiskit (from versions: ) No matching distribution found for qiskit"

Start-up your system and open the terminal type these commands:

sudo apt-get update
sudo apt-get dist-upgrade
conda info --env   

it will give you least one environment which is most of the time named as "base" or something else if you installed anaconda with more customization. Now activate the one with asterisk "*".

conda activate base
pip install qiskit --upgrade

so it will take some time. I am showing you some last lines enter image description here

Here you can see the qiskit 0.19.6 is uninstalling and it is installing 0.20.0

Make sure you have the latest version of python, and qiskit installed because they rely on each other that's why you should never install custom qiskit versions without knowing the correct python related versions.

you can check the qiskit and all of it's components version by typing:

conda list

and I got this after scrolling up

qiskit                    0.20.0                   pypi_0    pypi
qiskit-aer                0.6.1                    pypi_0    pypi
qiskit-aqua               0.7.5                    pypi_0    pypi
qiskit-ibmq-provider      0.8.0                    pypi_0    pypi
qiskit-ignis              0.4.0                    pypi_0    pypi
qiskit-terra              0.15.1                   pypi_0    pypi

rebooting your pc will give you some extra powers at this point.

Mashaallah! we got working and upto date Qiskit. Now you can run Jupyter Notebook without any casualty Inshaallah.

Answered by Hassan Afridi on January 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP