unitaryfund / mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.
https://mitiq.readthedocs.io
GNU General Public License v3.0
358 stars 157 forks source link

Depend only on the Qiskit packages we really need #396

Closed karalekas closed 3 years ago

karalekas commented 3 years ago

Issue Description

Right now, we have qiskit in the requirements.txt file, as it is an optional third-party integration. This is a "meta" package that just installs other Qiskit libraries. For example, this is what is installed when you do pip install qiskit as of today:

qiskit                        0.16.2
qiskit-aer                    0.4.1
qiskit-aqua                   0.6.5
qiskit-ibmq-provider          0.5.0
qiskit-ignis                  0.2.0
qiskit-terra                  0.12.0

This is likely more than we need to run Mitiq, and additionally makes import mitiq quite slow. The goal of this issue is to only install the Qiskit packages we really need in requirements.txt.

karalekas commented 3 years ago

@purva-thakre Welcome! Thanks for the interest :) in the mitiq source there are various imports from Qiskit libraries, as you noticed. In addition to Aer, the imports that seem to come from just qiskit (e.g. QuantumCircuit) are most likely from qiskit-terra (see https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/quantumcircuit.py for example). Thus, my hunch is that qiskit-aer and qiskit-terra are the only two that we depend on directly. You could test this by installing just those two libraries and verifying that the test suite still runs without error. Let me know if that makes sense!

purva-thakre commented 3 years ago

Ok. thanks !

Sorry. I accidentally deleted my previous comment. I was trying to edit it.

karalekas commented 3 years ago

@purva-thakre Welcome to the v0.4.0 milestone! :)

purva-thakre commented 3 years ago

In addition to qiskit-aer and qiskit-terra, qiskit-ibmq-provider is also needed. I'll check for more.

rmlarose commented 3 years ago

I imagine these are the only ones. If we rely on aqua something's gone terribly wrong :sweat_smile:

purva-thakre commented 3 years ago

Putting this on hold until a better version of pip's dependency resolver is released. Currently pip backtracks over all older versions of a package. See https://github.com/unitaryfund/mitiq/pull/485#discussion_r551542320

purva-thakre commented 3 years ago

@rmlarose I think you could re-open this issue. There's no checks being run for Python 3.6 in Github workflows. So, maybe the pip dependency resolver will not get stuck.

rmlarose commented 3 years ago

Great, thanks @purva-thakre! Setting up requirements takes about 2 minutes in CI now, so if we save time on this that would be great.