Error in running: demonstrations/

When I ran, I got:

Traceback (most recent call last):
  File "C:\", line 35, in <module>
    import pennylane as qml
  File "C:\Miniconda3\lib\site-packages\pennylane\", line 113, in <module>
    qchem = entry.load()
  File "C:\Miniconda3\lib\site-packages\pkg_resources\", line 2453, in load
    return self.resolve()
  File "C:\Miniconda3\lib\site-packages\pkg_resources\", line 2459, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Miniconda3\lib\site-packages\pennylane_qchem\", line 17, in <module>
    from . import qchem
  File "C:\Miniconda3\lib\site-packages\pennylane_qchem\qchem\", line 16, in <module>
    from .structure import *
  File "C:\Miniconda3\lib\site-packages\pennylane_qchem\qchem\", line 25, in <module>
    from openfermionpyscf import run_pyscf
ModuleNotFoundError: No module named 'openfermionpyscf'

I do not know the reason for calling:

qchem = entry.load()

when importing pennylane

I use Windows 10


Hi @cubicgate,

Thanks for reaching out! Unfortunately, some of the underlying libraries used in Pennylane-Qchem (namely, PySCF) are not supported in Windows. To use qchem on Windows we typically recommend to use a Linux-based system such as Windows Subsystem for Linux, or even something like Colab.

For the entry.load() call, this is used to load up the qchem module if it is available. You can see the context in the source here.

That all being said, the demo doesn’t actually require PennyLane-Qchem. If you’ve installed qchem manually, uninstall it, verify that you can import PennyLane, and try again to run the demo. Also, ensure you’re using the latest version of PennyLane (0.13), as there was an update a few months ago that should have made PySCF optional on Windows to enable a smooth installation that includes qchem (albeit without some of the functionality afford by PySCF).

Please let us know how it goes, and if you have any further questions!

Thanks @glassnotes for your help! After removing Pennylane and Pennylane-Qchem, and then reinstalling Pennylane, the program works.

Glad to hear it, thanks for letting us know!

After uninstall also, ModuleNotFoundError: No module named ‘openfermionpyscf’ keep on coming

Hi @Amandeep,

That sounds strange! Could you perhaps post the entire traceback? :thinking:It would indicate that something is still using openfermionpyscf, which should not be the case.