I was using command-: from qiskit.aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name but it was giving error-:

ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 8>()
      6 from qiskit.circuit.library import ZZFeatureMap
      7 from qiskit_machine_learning.algorithms import QSVC
----> 8 from qiskit.aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name

ModuleNotFoundError: No module named 'qiskit.aqua'

I checked import error :No module named 'qiskit_aqua' but it was outdated.

I also checked https://qiskit.org/documentation/stable/0.28/aqua_tutorials/Qiskit%20Algorithms%20Migration%20Guide.html but did not found about it.

  • $\begingroup$ pip install qiskit-aqua $\endgroup$ May 1, 2022 at 11:15
  • $\begingroup$ @Egretta.Thula I tried but it is giving errors on installation for h5py and python tries to choose different version of h5py and not installs. $\endgroup$ May 1, 2022 at 11:18
  • $\begingroup$ This is a Python-related question. You can post it in Stackoverflow for good answers. My suggestion: if these two functions are all what you need from Qiskit Aqua, you can copy them from here. $\endgroup$ May 1, 2022 at 11:33
  • $\begingroup$ @Egretta.Thula Ok. But is there any other way to import it as I want to keep my code clean. $\endgroup$ May 1, 2022 at 11:40
  • $\begingroup$ As Qiskit Aqua is deprecated, your code will be cleaner without depending on it. $\endgroup$ May 1, 2022 at 11:59

1 Answer 1


To fix this issue, required code needs to be copied and applied in python from-: https://github.com/Qiskit/qiskit-aqua/blob/main/qiskit/aqua/utils/dataset_helper.py

This is based on Egretta.Thula's suggestion.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.