Unable to find qiskit in jupyter lab

Unable to find qiskit in jupyter lab

by Daniel Andrzej Polka -
Number of replies: 2

Hi,

I installed qiskit in a virtual environment, activated the environment then launched jupyter lab. However, jupyter lab cannot find the qiskit module. When in the jupyter notebook, if I add "!pip3 list" to the top of the first cell, as well as a bunch of other modules, qiskit is present (it lists qiskit 0.45.1, qiskit-ibm-provider 0.7.3, qiskit-ibm-runtime 0.17.0 and qiskit-terra 0.45.1). Underneath this list where it claims qiskit to be present, I get "ModuleNotFoundError: No module named 'qiskit'". Does anyone have any ideas/has this happened to anyone else?

In reply to Daniel Andrzej Polka

Re: Unable to find qiskit in jupyter lab

by Dina Khaled Sayed Abdelhadi -
Hi,
Hello,
You can use the IBM Lab from quantum.ibm.com (it is in the 'Learning' box in the screenshot)
and upload the jupyter notebook, and let us know if you are still having trouble with it.
If you prefer to install locally, may be https://docs.quantum.ibm.com/start/install can be useful.
You can use whatever libraries you prefer to implement the project, the ones in the notebook are there as a hint.
Best,
Dina
quantum lab
In reply to Dina Khaled Sayed Abdelhadi

Re: Unable to find qiskit in jupyter lab

by Daniel Andrzej Polka -
Ok thanks!

Actually I managed to fix it in the end, for anyone who might be encountering the same problem, the issue was that the virtual environment was set up correctly but not "registered" for jupyter lab (so it existed, but jupyter lab was using my global conda environment instead). To fix this, you first need to activate your virtual environment (let's say its name is "my_env"), then run the following command to "register" your environment:
python -m ipykernel install --user --name=my_env
Next, launch (or restart) jupyter lab. Then go to the "Kernel" drop-down menu and click "Change Kernel...", where you should be able to choose your environment my_env, then it should all work.