You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Jupyter notebook, importing qiskit doesn't work. For example,
importqiskitprint(qiskit)
<module 'qiskit' (namespace)>
fromqiskitimportQuantumCircuit
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 from qiskit import QuantumCircuit
ImportError: cannot import name 'QuantumCircuit' from 'qiskit' (unknown location)
What is the expected behavior?
Qiskit should work in the Jupyter notebook. It does work in a shell though.
Suggested solutions
I don't know if this is related but I noticed that installing Qiskit Aer adds files to the virtual environment root where it seems they shouldn't be. For example, before installing Aer the virtual environment root has these contents:
This is a broader bug in python packaging around namespace packages see Qiskit/qiskit#559. Namespace packaging in python is very error prone and I've been working for a long time on trying to fix this by removing namespace packaging from qiskit, and hopefully once #1526 merges we'll finally be done with using namespace packages for good.
The workaround in the meantime is try not to mix editable mode and standard installs of packages in the shared namespace, but if you must install terra first in editable mode and then try installing aer from pypi second.
As for the stray contents in the venv that's already reported in #1457 and is an upstream bug in scikit-build around the MANIFEST.in file.
Thanks @mtreinish . I tried installing both qiskit-terra and qiskit-ibmq-provider in editable mode, but installing the latter still causes the issue.
I also tried installing qiskit-aer in editable mode. The same issue occurs, and what is more, it persists even after uninstalling qiskit-aer. In other words, installing qiskit-aer seems to permanently bork the environment.
Informations
What is the current behavior?
qiskit namespace conflicts with Qiskit Terra in Jupyter environment
Steps to reproduce the problem
qiskit
doesn't work. For example,What is the expected behavior?
Qiskit should work in the Jupyter notebook. It does work in a shell though.
Suggested solutions
I don't know if this is related but I noticed that installing Qiskit Aer adds files to the virtual environment root where it seems they shouldn't be. For example, before installing Aer the virtual environment root has these contents:
After installing Aer, the contents are like this:
Most of the extra files seem to be from the Qiskit Aer repository.
The text was updated successfully, but these errors were encountered: