0

While using the IBM Quantum experience, whenever I want to install any driver an error with the h5py appears.

Specifically, the error is

"Using default_file_mode other than 'r' is no longer supported. Pass the mode to h5py.File() instead."

Does anyone have any solutions to it (not sure which version to revert back to). Thanks!!

Josh Adams
  • 2,113
  • 2
  • 13
  • 25
  • What do you mean by "install any driver"? Is this a driver for the operating system, or in some Python/h5py code? Please post the commands/code you entered when the error occurs. – kcw78 Dec 22 '21 at 15:07
  • Here is the code that I used: from qiskit_nature.drivers.second_quantization import HDF5Driver – Je-Yu Chou Dec 22 '21 at 15:09
  • I think the driver is used so I can create a class of molecule and also save it as an H5py file for later use – Je-Yu Chou Dec 22 '21 at 15:10

1 Answers1

0

You will need to add more details about your question. I could not replicate your error based on the information you provided. This is what I did:

First, I installed Qiskit Nature with this command pip install qiskit[nature].
Next, I entered the following Python commands:

>>> from qiskit_nature.drivers.second_quantization import HDF5Driver
>>> h5f = HDF5Driver()
>>> h5f
<qiskit_nature.drivers.second_quantization.hdf5d.hdf5driver.HDF5Driver object at 0x7fa28320a820>
>>> h5f.run()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/qiskit_nature/drivers/second_quantization/hdf5d/hdf5driver.py", line 63, in run
    raise LookupError(f"HDF5 file not found: {hdf5_file}")
LookupError: HDF5 file not found: molecule.hdf5

There is no error when I imported the HDF5Driver module from the qiskit_nature package. An error occurs when I enter h5f.run(). This is expected, because I don't have a file named molecule.hdf5 (the default filename). If you have a different filename, modify commands above to use h5f = HDF5Driver("your_filename").

Tests run with Python 3.8.12 and qiskit_nature 0.3.0 running on Ubuntu Linux 5.11.0-1023-gcp.

kcw78
  • 7,131
  • 3
  • 12
  • 44