1
$\begingroup$

I have updated qiskit to the newest version using pip install qiskit --upgrade and all was done successfully, and when I write pip list on the command line I get:

enter image description here

As I should. But then I run help("modules") on a jupyter notebook and get:

enter image description here

which I don't understand why are there no other modules. And obviously import qiskit throws an error as well. Any idea how to solve this?

PS: This is a follow-up from this question

$\endgroup$
9
  • $\begingroup$ Are you using any virtual envs? This sounds like it is probably an issue with your Python path $\endgroup$
    – met927
    Mar 4 '20 at 16:00
  • $\begingroup$ yes, I created a virtual environment for qiskit $\endgroup$
    – Bidon
    Mar 4 '20 at 16:01
  • 1
    $\begingroup$ you are most probably running a different python distribution/environment on the notebook. If you use conda, see e.g. this page. More generally, make sure to start jupyter from the terminal from the same environment you installed qiskit in. This question isn't really about qiskit, only about how to use python packages $\endgroup$
    – glS
    Mar 5 '20 at 15:25
  • 4
    $\begingroup$ I'm voting to close this question as off-topic because it has nothing to do with qiskit $\endgroup$
    – glS
    Mar 5 '20 at 15:26
  • 1
    $\begingroup$ Yes, that was the problem and I managed to solve it directly with the anaconda navigator. $\endgroup$
    – Bidon
    Mar 5 '20 at 15:29
-2
$\begingroup$

A workaround to fix this is to manually add the qiskit install location to your python path in the notebook. You can find the path by running pip show qiskit in a terminal, which will return a field called Location. In the notebook then add the following lines

import sys
sys.path.append('the location')
$\endgroup$
2
  • 3
    $\begingroup$ you really shouldn't have to do this. If you installed the package correctly, it will be found. Changing the path manually like this to point to a package installed into another distribution is a great way to mess things up (unless you downloaded the package manually rather than with a package manager). $\endgroup$
    – glS
    Mar 5 '20 at 15:28
  • 1
    $\begingroup$ But is there any other answer to the question? No. So why the two -1 votes and nasty comment. $\endgroup$ Jul 26 '21 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.