qiskit-community / qiskit-ignis

Ignis (deprecated) provides tools for quantum hardware verification, noise characterization, and error correction.
Apache License 2.0
168 stars 160 forks source link

BrokenProcessPool Error when running ignis code calling parallel.py #419

Closed nathanearnestnoble closed 4 years ago

nathanearnestnoble commented 4 years ago

Informations

What is the current behavior?

Running Code to perform Quantum Process Tomography using Ignis. Multiple people have tried running this code not using operating system Catalina (they uses older macos's or linux) and the issue has arisen with multiple version of qiskit. The only common factor I have found through these errors is that I am using Catalina and others are not.

BrokenProcessPool Traceback (most recent call last)

in ----> 1 choi_mats = [choi for choi in my_experiment.extract_choi_matrix(result=result)] in (.0) ----> 1 choi_mats = [choi for choi in my_experiment.extract_choi_matrix(result=result)] ~/Box Sync/Nate_ Q Start/Research:Studying/Jupyter notebooks/OpenPulse/CZ/Working Notebooks/utils/qpt.py in extract_choi_matrix(self, result) 143 chunk=len(qpt_qcs)) 144 if meas_fitter: --> 145 qpt_results.append(meas_fitter.filter.apply(qpt_result)) 146 else: 147 qpt_results.append(qpt_result) /opt/anaconda3/envs/QPT3/lib/python3.7/site-packages/qiskit/ignis/mitigation/measurement/filters.py in apply(self, raw_data, method) 144 self._apply_correction, 145 [resultidx for resultidx, _ in enumerate(raw_data.results)], --> 146 task_args=(raw_data, method)) 147 148 for resultidx, new_counts in new_counts_list: /opt/anaconda3/envs/QPT3/lib/python3.7/site-packages/qiskit/tools/parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes) 132 # Otherwise just reset parallel flag and error 133 os.environ['QISKIT_IN_PARALLEL'] = 'FALSE' --> 134 raise error 135 136 Publisher().publish("terra.parallel.finish") /opt/anaconda3/envs/QPT3/lib/python3.7/site-packages/qiskit/tools/parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes) 122 future = executor.map(_task_wrapper, param) 123 --> 124 results = list(future) 125 Publisher().publish("terra.parallel.done", len(results)) 126 /opt/anaconda3/envs/QPT3/lib/python3.7/concurrent/futures/process.py in _chain_from_iterable_of_lists(iterable) 481 careful not to keep references to yielded objects. 482 """ --> 483 for element in iterable: 484 element.reverse() 485 while element: /opt/anaconda3/envs/QPT3/lib/python3.7/concurrent/futures/_base.py in result_iterator() 596 # Careful not to keep a reference to the popped future 597 if timeout is None: --> 598 yield fs.pop().result() 599 else: 600 yield fs.pop().result(end_time - time.monotonic()) /opt/anaconda3/envs/QPT3/lib/python3.7/concurrent/futures/_base.py in result(self, timeout) 426 raise CancelledError() 427 elif self._state == FINISHED: --> 428 return self.__get_result() 429 430 self._condition.wait(timeout) /opt/anaconda3/envs/QPT3/lib/python3.7/concurrent/futures/_base.py in __get_result(self) 382 def __get_result(self): 383 if self._exception: --> 384 raise self._exception 385 else: 386 return self._result BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending. ### Steps to reproduce the problem This error has come up in a variety of situations. But specific to this problem, I get the error each time try to make use of the parallel_map. Each time I have asked others to run the code who are not using MacOS Catalina, and it works well for them. ### What is the expected behavior? That this runs with no errors. ### Suggested solutions Dont download Catalina....?
nonhermitian commented 4 years ago

You are probably importing matplotlib somewhere before your calling parallel_map. This is a known bug, and supposedly fixed upstream in matplotlib https://github.com/matplotlib/matplotlib/issues/15410

nathanearnestnoble commented 4 years ago

Thanks @nonhermitian . Following your provided thread, the BrokenProcessPool error was fixed by upgrading python to 3.8.2.

Some subsequent errors came up that were fixed by installing cvxpy (version 1.0.25) and cvxopt (version 1.2.5). There were some errors when installing cvxpy version 1.1.1