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

Bayes factory fails on Windows build due to pymc3 install / dependencies #620

Closed nathanshammah closed 2 years ago

nathanshammah commented 3 years ago

Full message:

================================== FAILURES ===================================
_____________________________ test_exp_bayes_extr _____________________________
[gw1] win32 -- Python 3.8.8 c:\hostedtoolcache\windows\python\3.8.8\x64\python.exe

    def test_exp_bayes_extr():
        """Test of the ExpBayesFactory's extrapolator."""
        x_vals = np.linspace(1.0, 5.0, 20)
        seeded_f = apply_seed_to_func(f_exp_bayes, SEED)
        fac = ExpBayesFactory(scale_factors=x_vals)
        assert not fac._opt_params
        fac.run_classical(seeded_f)
>       zne_value = fac.reduce()

mitiq\zne\tests\test_inference.py:462: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mitiq\zne\inference.py:1612: in reduce
    ) = self.extrapolate(  # type: ignore
mitiq\zne\inference.py:1565: in extrapolate
    a = pm.Normal("a", 0, 5)
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\pymc3\distributions\distribution.py:121: in __new__
    dist = cls.dist(*args, **kwargs)
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\pymc3\distributions\distribution.py:130: in dist
    dist.__init__(*args, **kwargs)
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\pymc3\distributions\continuous.py:488: in __init__
    self.variance = 1.0 / self.tau
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\tensor\var.py:176: in __rtruediv__
    return theano.tensor.basic.true_div(other, self)
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\graph\op.py:253: in __call__
    compute_test_value(node)
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\graph\op.py:126: in compute_test_value
    thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\graph\op.py:634: in make_thunk
    return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\graph\op.py:600: in make_c_thunk
    outputs = cl.make_thunk(
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\link\c\basic.py:1203: in make_thunk
    cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\link\c\basic.py:1138: in __compile__
    thunk, module = self.cthunk_factory(
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\link\c\basic.py:1634: in cthunk_factory
    module = get_module_cache().module_from_key(key=key, lnk=self)
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\link\c\cmodule.py:1191: in module_from_key
    module = lnk.compile_cmodule(location)
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\link\c\basic.py:1543: in compile_cmodule
    module = c_compiler.compile_str(
c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\link\c\cmodule.py:2557: in compile_str
    return dlimport(lib_filename)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

fullpath = 'C:\\Users\\runneradmin\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.17763-SP0-Intel64_Family_6_Model_63_Stepping_2_GenuineIntel-3.8.8-64\\tmphsoxh7a_\\m31975b6dadb59d49af3f2b36405378825884299512ee0ed9081be33fa591d30d.pyd'
suffix = '.pyd'
        global import_time
        try:
            importlib.invalidate_caches()
            t0 = time.time()
            with warnings.catch_warnings():
                warnings.filterwarnings("ignore", message="numpy.ndarray size changed")
>               rval = __import__(module_name, {}, {}, [module_name])
E               ImportError: DLL load failed while importing m31975b6dadb59d49af3f2b36405378825884299512ee0ed9081be33fa591d30d: The specified module could not be found.

c:\hostedtoolcache\windows\python\3.8.8\x64\lib\site-packages\theano\link\c\cmodule.py:294: ImportError

----------- coverage: platform win32, python 3.8.8-final-0 -----------
Name                                          Stmts   Miss  Cover
-----------------------------------------------------------------
mitiq\__init__.py                                 5      0   100%
mitiq\_about.py                                  24     10    58%
mitiq\_typing.py                                  9      0   100%
mitiq\_version.py                                 5      0   100%
mitiq\benchmarks\__init__.py                      1      0   100%
mitiq\benchmarks\maxcut.py                       44      2    95%
mitiq\benchmarks\random_circuits.py              45      2    96%
mitiq\benchmarks\randomized_benchmarking.py      15      1    93%
mitiq\benchmarks\utils.py                        11      0   100%
mitiq\collector.py                               61      0   100%
mitiq\conversions.py                             66      1    98%
mitiq\mitiq_pyquil\__init__.py                    1      0   100%
mitiq\mitiq_pyquil\compiler.py                  149    149     0%
mitiq\mitiq_pyquil\conversions.py                17      0   100%
mitiq\mitiq_pyquil\pyquil_utils.py               29     29     0%
mitiq\mitiq_qiskit\__init__.py                    2      0   100%
mitiq\mitiq_qiskit\conversions.py                94     12    87%
mitiq\mitiq_qiskit\qiskit_utils.py               49     34    31%
mitiq\pec\__init__.py                             4      0   100%
mitiq\pec\pec.py                                 34      1    97%
mitiq\pec\representations\__init__.py             1      0   100%
mitiq\pec\representations\depolarizing.py        73      0   100%
mitiq\pec\sampling.py                            36      1    97%
mitiq\pec\types\__init__.py                       1      0   100%
mitiq\pec\types\types.py                        188      4    98%
mitiq\pec\utils.py                               20      0   100%
mitiq\utils.py                                   71      0   100%
mitiq\zne\__init__.py                             3      0   100%
mitiq\zne\inference.py                          407     37    91%
mitiq\zne\scaling\__init__.py                     3      0   100%
mitiq\zne\scaling\folding.py                    213      7    97%
mitiq\zne\scaling\parameter.py                   48      0   100%
mitiq\zne\zne.py                                 29      1    97%
-----------------------------------------------------------------
TOTAL                                          1758    291    83%
Coverage XML written to file coverage.xml

=========================== short test summary info ===========================
FAILED mitiq/zne/tests/test_inference.py::test_exp_bayes_extr - ImportError: ...
============ 1 failed, 608 passed, 3 skipped in 142.02s (0:02:22) =============
mingw32-make: *** [Makefile:63: test] Error 1
rmlarose commented 3 years ago

Master is no longer failing because this was reverted (#625) - updated name to reflect this. The issue is now to update #471 so this error doesn't happen on Windows and can be merged back into master.

elmandouh commented 3 years ago

I believe this should be fixed by adding the most recent version of cython to the requirement, i.e add the line cython~=0.29.21 to requirements.txt. It seems to run fine on my computer, maybe @nathanshammah or @rmlarose can test this solution?

rmlarose commented 3 years ago

@elmandouh tested, still failing with same error I think. See #646.

rmlarose commented 3 years ago

Here's what we decided (Origin https://github.com/unitaryfund/mitiq/issues/678#issuecomment-846070537):

(i) keep using pip, (ii) handle the pymc3 install in CI on windows as a special case, (iii) tell people if they want to use pymc3 on windows, they have to install whatever needs to be installed.

rmlarose commented 3 years ago

There were some updates to pymc3 and its dependencies which may have resolved this issue. I tried with earlier updates https://github.com/unitaryfund/mitiq/pull/715/commits/0c1eca32edc41f5bddc7867cf8a88a5e2f0831b6, https://github.com/unitaryfund/mitiq/pull/715/commits/ffa131963a6e869a46ec6d47ba270ecd1da3faa1, https://github.com/unitaryfund/mitiq/pull/715/commits/ffa131963a6e869a46ec6d47ba270ecd1da3faa1) to no avail, but there have been further updates since then.

github-actions[bot] commented 3 years ago

This issue had no activity for 2 months, and will be closed in one week unless there is new activity. Cheers!

crazy4pi314 commented 3 years ago

This is being addressed in #646

github-actions[bot] commented 2 years ago

This issue had no activity for 2 months, and will be closed in one week unless there is new activity. Cheers!