1
$\begingroup$

I have a problem when attempting to set up a PySCF driver for a hydrogen molecule from the QISKIT Chemistry tutorial: https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html.

The code:

from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule

molecule = Molecule(geometry = [['H', [0., 0., 0.]],
                                ['H', [0., 0., 0.735]]],
                    charge = 0 , multiplicity = 1)

driver = PySCFDriver(molecule = molecule, unit = UnitsType.ANGSTROM, basis = 'sto3g')

When this is run, I receive: ImportError: cannot import name 'Molecule' from 'qiskit.chemistry.drivers' (C:\Users\louis\anaconda3\lib\site-packages\qiskit\chemistry\drivers_init_.py) I am not entirely sure what is causing this error and any help would be appreciated.

$\endgroup$
0
$\begingroup$

The molecule was introduced in the latest release. You need qiskit aqua 0.8.0. Can you provide information of your qiskit versions and your operating system? In case you need to update to the latest version to run the tutorials.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Qiskit versions: {'qiskit-terra': '0.15.2', 'qiskit-aer': '0.6.1', 'qiskit-ignis': '0.4.0', 'qiskit-ibmq-provider': '0.10.0', 'qiskit-aqua': '0.7.5', 'qiskit': '0.22.0'} Operating system is Windows 10 $\endgroup$ – LouisL Nov 5 at 13:19
  • $\begingroup$ As the other answer pointed out, Molecule is a new release of Qiskit so you would need to update your Qiskit to the latest version to use it (maybe through pip install qiskit --upgrade). I just tried to use it on the latest version of qiskit {'qiskit-terra': '0.16.0', 'qiskit-aer': '0.67.0', 'qiskit-ignis': '0.5.0', 'qiskit-aqua': '0.8.0', 'qiskit': '0.23.0'} and the code you posted seems to work just fine. $\endgroup$ – KAJ226 Nov 5 at 16:35
  • $\begingroup$ Thank you for the responses as you have fixed the original issue, however, a new one has come up. When running the code above, I now receive QiskitChemistryError: 'PySCF is not installed. See https://sunqm.github.io/pyscf/install.html' I thought PySCF was installed but decided to attempt to install it anyway in the anaconda prompt with: pip install pyscf But this returns an error: NameError: name 'LD_LIBRARY_PATH' is not defined Any help to fix this problem would be appreciated. $\endgroup$ – LouisL Nov 5 at 18:47
  • $\begingroup$ @LouisL This might be a problem... because PySCF works in Linux environment and you are using Windows. I am not sure if you can pip install PySCF. One quick work around that I can think of is to use the IBMQ Experience Jupyter notebook environment. There should be no problem there. $\endgroup$ – KAJ226 Nov 5 at 19:20
  • 1
    $\begingroup$ @KAJ226 Thank you for the help, using the IBMQ Experience Jupyter notebook environment has no problem. I was unaware PySCF only worked in a Linux environment (always read the fineprint!) $\endgroup$ – LouisL Nov 10 at 14:18

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.