Unable to import library to simulate molecules

I am attempting to simulate a hydrogen molecule using a variational quantum eigensolver using the tutorial given here. However, when I ran the following:

H, qubits = qml.qchem.molecular_hamiltonian(symbols, coordinates)

I received the following error:

No module named 'openfermionpyscf'

I tried to install the package but without success. The error is given as such:

ERROR: The tar file (C:\Users\13473\AppData\Local\Temp\pip-unpack-6nux8jpy\pyscf-2.0.1.tar.gz) has a file (C:\Users\13473\AppData\Local\Temp\pip-install-lid9qlwh\pyscf\pyscf/agf2/aux.py) trying to install outside target directory (C:\Users\13473\AppData\Local\Temp\pip-install-lid9qlwh\pyscf)

I suppose I might have install pennylane incorrectly, but I highly doubt this because this is an entirely new virtual environment. I downloaded pennylane using the instructions provided here. Is there a clear solution to this problem?

Hi @Hatedfate,
Welcome to this community!
Why don’t we give another try with the installation?
If you could, please follow the step-by-step below and let me know if it worked. I’m assuming you are using conda.
Create a new conda environment with:
conda create --name name_of_your_environment python=3.9
Activate the environment:
conda activate name_of_your_environment
and after this you can install the needed packages:
pip install pennylane pennylane-qchem
This should be sufficient for running your code.
Please let us know if it worked and if you have any other questions.

Hello, I did attempt to try this and it did not work out for some reason. But, I decided to move to a linux operating system and everything seems to work out fine there.

Hi @Hatedfate,
I’m happy you were able to find a solution.
Thanks for letting us know.

1 Like