Help on PySCF library

I am a student and I am trying to use qiskit nature in order to calculate the ground state energy of a molecule. My probelm is that when I try to run the simulation an error message comes out:

Traceback (most recent call last):
Input In [7] in <cell line: 4>
res = calc.solve(es_problem)
File /opt/conda/lib/python3.8/site-packages/qiskit_nature/algorithms/ground_state_solvers/ground_state_eigensolver.py:93 in solve
second_q_ops = problem.second_q_ops()
File /opt/conda/lib/python3.8/site-packages/qiskit_nature/problems/second_quantization/electronic/electronic_structure_problem.py:94 in second_q_ops
driver_result = self.driver.run()
File /opt/conda/lib/python3.8/site-packages/qiskit_nature/drivers/second_quantization/electronic_structure_molecule_driver.py:173 in run
driver_class = ElectronicStructureDriverType.driver_class_from_type(
File /opt/conda/lib/python3.8/site-packages/qiskit_nature/drivers/second_quantization/electronic_structure_molecule_driver.py:84 in driver_class_from_type
class_obj.check_installed()
File /opt/conda/lib/python3.8/site-packages/qiskit_nature/drivers/second_quantization/pyscfd/pyscfdriver.py:382 in check_installed
raise MissingOptionalLibraryError(
MissingOptionalLibraryError: The 'PySCF' library is required to use 'PySCFDriver'. You can install it with 'pip install 'qiskit-nature[pyscf]''.  See https://pyscf.org/install.html.


I have installed PySCF using qiskit-nature[pyscf] and I also followed the instructions on pyscf.org , but the message keeps coming out, even if everything is already installed. Where I am doing the mistake? The code I am trying to run is the tutorial: https://qiskit.org/documentation/nature/tutorials/03_ground_state_solvers.html

• pip show pyscf shows its installed right in that environment you are running the tutorial. I have seen a couple of people say similar when they have been using the IBM Quantum Experience - for them re-installing qiskit-nature fixed things. Jun 17 at 15:13
• I gave this command and this is what comes out: Name: pyscf Version: 2.0.1 Summary: PySCF: Python-based Simulations of Chemistry Framework Home-page: pyscf.org Author: Qiming Sun Author-email: osirpt.sun@gmail.com License: Apache License 2.0 Location: /home/natale/.local/lib/python3.8/site-packages Requires: numpy, scipy, h5py Required-by: ; may the problem be that pyscf is in site-packages and qiskit is looking for it in other directories? Jun 18 at 15:17

try the following step:

1. (uninstall both pakage)!pip uninstall qiskit_nature --yes
!pip uninstall pyscf --yes
2. (check if uninstalled)!pip show qiskit_nature
!pip show pyscf
3. (install both package)!pip install qiskit-nature[pyscf] -U or
(follow sequence) 1.!pip install qiskit-nature 2.pip install pyscf
4. do the step 2 again check both is installed
5. restart kernel, it should work like magic.
• I tried but it says on both runs that requirements are already satisfied, so it skips the upgrading... Jun 18 at 15:13
• @NataleMatranga uninstall
– poig
Jun 18 at 20:14
• It still doesn't work, I can't figure out why. I uninstalled and installed again, I tried to do this firstly via pip, then conda. Jun 20 at 13:07
• @NataleMatranga I edit my answer, I tried the method on IBM lab, it solved the issue.
– poig
Jun 20 at 16:52
• I accept your answer, but it has not solved the problem... it keeps saying that I must install pyscf, but I checked as you said, they are installed... Jun 21 at 15:45