wmayner / pyphi

A toolbox for integrated information theory.
https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006343
Other
379 stars 97 forks source link

Python3.12: Tests fail #108

Open penguinpee opened 1 year ago

penguinpee commented 1 year ago

Python 3.12 has landed in Fedora. Rebuilding pyphi with Python 3.12 results in the following test failure:

=================================== FAILURES ===================================
___________________________ [doctest] 2014paper.rst ____________________________
549 
550 Figure 12
551 ~~~~~~~~~
552 
553 **Assessing the integrated conceptual information Φ of a constellation C.**
554 
555 To calculate :math:`\Phi^{\textrm{MIP}}` for a candidate set, we use the
556 function |compute.sia()|:
557 
558     >>> sia = pyphi.compute.sia(subsystem)
UNEXPECTED EXCEPTION: ValueError("Unable to configure handler 'queue'")
Traceback (most recent call last):
  File "/usr/lib64/python3.12/doctest.py", line 1357, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest 2014paper.rst[78]>", line 1, in <module>
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/subsystem.py", line 323, in sia
    return _sia(_sia_cache_key(subsystem), subsystem)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/memory.py", line 35, in wrapper
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/utils.py", line 213, in time_annotated
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/subsystem.py", line 262, in _sia
    unpartitioned_ces = _ces(subsystem)
                        ^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/subsystem.py", line 208, in _ces
    return ces(subsystem, parallel=config.PARALLEL_CUT_EVALUATION)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/utils.py", line 213, in time_annotated
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/subsystem.py", line 96, in ces
    return CauseEffectStructure(engine.run(parallel or
                                ^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 331, in run
    return self.run_parallel()
           ^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 266, in run_parallel
    r.reraise()
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 64, in reraise
    raise self.exception.with_traceback(self.tb.as_traceback())
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 174, in worker
    configure_worker_logging(log_queue)
    ^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/pyphi-1.2.1/pyphi/compute/parallel.py", line 361, in configure_worker_logging
    logging.config.dictConfig(
      ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/logging/config.py", line 912, in dictConfig
    dictConfigClass(config).configure()
      ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/logging/config.py", line 588, in configure
    raise ValueError('Unable to configure handler '
    ^^^^^^^^^^^^^^^^^
ValueError: Unable to configure handler 'queue'
/builddir/build/BUILD/pyphi-1.2.1/docs/examples/2014paper.rst:558: UnexpectedException
penguinpee commented 1 year ago

After disabling maxfail=1 in pytest.ini it turned out more tests are failing:

=========================================================================================================================== short test summary info ============================================================================================================================
FAILED docs/examples/2014paper.rst::2014paper.rst
FAILED docs/examples/emergence.rst::emergence.rst
FAILED docs/examples/index.rst::index.rst
FAILED docs/examples/magic_cut.rst::magic_cut.rst
FAILED docs/examples/xor.rst::xor.rst
FAILED test/test_actual.py::test_true_events - ValueError: Unable to configure handler 'queue'
FAILED test/test_actual.py::test_extrinsic_events - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_sia_cache_key_includes_config_dependencies - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_sia_single_micro_node_selfloops_have_phi - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_find_sia_parallel_standard_example - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_find_sia_parallel_noised_example - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_find_sia_parallel_micro - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_complexes_standard - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_all_complexes_standard - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_all_complexes_parallelization - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_sia_complete_graph_standard_example - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_sia_complete_graph_s_noised - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_sia_big_network_0_thru_3 - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_sia_macro - ValueError: Unable to configure handler 'queue'
FAILED test/test_big_phi.py::test_system_cut_styles - ValueError: Unable to configure handler 'queue'
FAILED test/test_ces.py::test_ces_distance_switches_to_small_phi_difference - ValueError: Unable to configure handler 'queue'
FAILED test/test_ces.py::test_parallel_and_sequential_ces_are_equal - ValueError: Unable to configure handler 'queue'
FAILED test/test_ces.py::test_ces_concepts_share_the_same_subsystem[True] - ValueError: Unable to configure handler 'queue'
FAILED test/test_concept_style_cuts.py::test_sia_concept_style - ValueError: Unable to configure handler 'queue'
FAILED test/test_concept_style_cuts.py::test_unpickle - ValueError: Unable to configure handler 'queue'
FAILED test/test_concept_style_cuts.py::test_concept_style_phi - ValueError: Unable to configure handler 'queue'
FAILED test/test_json.py::test_json_deserialization - ValueError: Unable to configure handler 'queue'
FAILED test/test_json.py::test_deserialization_memoizes_duplicate_objects - ValueError: Unable to configure handler 'queue'
FAILED test/test_macro_blackbox.py::test_degenerate - ValueError: Unable to configure handler 'queue'
FAILED test/test_parallel.py::test_map_square - ValueError: Unable to configure handler 'queue'
FAILED test/test_parallel.py::test_parallel_exception_handling - AssertionError: Regex pattern did not match.
FAILED test/test_parallel.py::test_config_persists_through_paralellization - ValueError: Unable to configure handler 'queue'
FAILED test/test_subsystem_expand.py::test_expand_cause_repertoire - ValueError: Unable to configure handler 'queue'
FAILED test/test_subsystem_expand.py::test_expand_effect_repertoire - ValueError: Unable to configure handler 'queue'
===================================================================================================== 34 failed, 520 passed, 21 skipped, 3 xfailed, 439 warnings in 26.23s =====================================================================================================
musicinmybrain commented 1 year ago

It looks like all of the failures are related to logging handler configuration. This change may be relevant:

https://discuss.python.org/t/a-new-feature-is-being-added-in-logging-config-dictconfig-to-configure-queuehandler-and-queuelistener/16124

See also: https://docs.python.org/3.12/library/logging.config.html#configuring-queuehandler-and-queuelistener