0
$\begingroup$

When trying to import qiskit I obtain following error:

/opt/anaconda3/lib/python3.8/site-packages/qiskit/__init__.py:63: RuntimeWarning: Could not import the Aer provider from the qiskit-aer package. Install qiskit-aer or check your installation.
  warnings.warn('Could not import the Aer provider from the qiskit-aer '
/opt/anaconda3/lib/python3.8/site-packages/qiskit/__init__.py:73: RuntimeWarning: Could not import the IBMQ provider from the qiskit-ibmq-provider package. Install qiskit-ibmq-provider or check your installation.
  warnings.warn('Could not import the IBMQ provider from the '
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-578b7f7e9727> in <module>
----> 1 import qiskit

/opt/anaconda3/lib/python3.8/site-packages/qiskit/__init__.py in <module>
     78 # Moved to after IBMQ and Aer imports due to import issues
     79 # with other modules that check for IBMQ (tools)
---> 80 from qiskit.execute import execute  # noqa
     81 from qiskit.compiler import transpile, assemble, schedule  # noqa
     82 

/opt/anaconda3/lib/python3.8/site-packages/qiskit/execute.py in <module>
     24 import logging
     25 from time import time
---> 26 from qiskit.compiler import transpile, assemble, schedule
     27 from qiskit.qobj.utils import MeasLevel, MeasReturnType
     28 from qiskit.pulse import Schedule

/opt/anaconda3/lib/python3.8/site-packages/qiskit/compiler/__init__.py in <module>
     33 
     34 from .assemble import assemble
---> 35 from .transpile import transpile
     36 from .schedule import schedule

/opt/anaconda3/lib/python3.8/site-packages/qiskit/compiler/transpile.py in <module>
     22 from qiskit.providers.models import BackendProperties
     23 from qiskit.providers.models.backendproperties import Gate
---> 24 from qiskit.transpiler import Layout, CouplingMap, PropertySet, PassManager
     25 from qiskit.transpiler.basepasses import BasePass
     26 from qiskit.dagcircuit import DAGCircuit

/opt/anaconda3/lib/python3.8/site-packages/qiskit/transpiler/__init__.py in <module>
    412 """
    413 
--> 414 from .runningpassmanager import FlowController
    415 from .passmanager import PassManager
    416 from .passmanager_config import PassManagerConfig

/opt/anaconda3/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py in <module>
     21 from time import time
     22 
---> 23 from qiskit.dagcircuit import DAGCircuit
     24 from qiskit.converters import circuit_to_dag, dag_to_circuit
     25 from .propertyset import PropertySet

/opt/anaconda3/lib/python3.8/site-packages/qiskit/dagcircuit/__init__.py in <module>
     39    DAGCircuitError
     40 """
---> 41 from .dagcircuit import DAGCircuit
     42 from .dagnode import DAGNode
     43 from .dagdepnode import DAGDepNode

/opt/anaconda3/lib/python3.8/site-packages/qiskit/dagcircuit/dagcircuit.py in <module>
     29 import math
     30 
---> 31 import retworkx as rx
     32 import networkx as nx
     33 

/opt/anaconda3/lib/python3.8/site-packages/retworkx/__init__.py in <module>
      7 # that they have been altered from the originals.
      8 
----> 9 from .retworkx import *
     10 
     11 

ModuleNotFoundError: No module named 'retworkx.retworkx' 

Have I installed Qiskit to the target directory incorrectly? I attempted to install Qiskit in Terminal using: python3 -m pip install qiskit -t /opt/anaconda3/lib/python3.8/site-packages.
I navigated to the path manually and I could find all the qiskit modules, including the retworkx modules (whatever it may be).
If anybody has experienced this sort of error before and happens to know a fix, I would appreciate it very much.

$\endgroup$
  • 1
    $\begingroup$ Can you open an interactive console and run import retworkx? $\endgroup$ – luciano Aug 23 at 14:39
1
$\begingroup$

It would be better if you install Qiskit after opening anaconda and then terminal from Anaconda and use pip install qiskit. For more info visit, you can try visiting https://qiskit.org

| improve this answer | |
$\endgroup$
1
$\begingroup$

I solved this issue by upgrading my python version:https://github.com/Qiskit/qiskit/issues/1040

| improve this answer | |
$\endgroup$

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.