papermill icon indicating copy to clipboard operation
papermill copied to clipboard

nbclient.exceptions.DeadKernelError if Python Warnings Filter set to 'default'

Open matthewfeickert opened this issue 3 years ago • 0 comments

Question

:wave: Hi. While trying to get a nightly notebook pytest test working again with modern papermill and scrapbook (c.f. https://github.com/scikit-hep/pyhf/pull/1841) I noticed that if I have Python filter warnings set to 'default', I can get a nbclient.exceptions.DeadKernelError from papermill if the notebook being executed has any IPython/Jupyter magics like shell evaluation with !.

Example from https://github.com/scikit-hep/pyhf/pull/1841:

    - name: Test example notebooks
      shell: bash
      run: |
        # Override the ini option for filterwarnings with an empty list to disable error
        # on filterwarnings as testing for notebooks to run with the latest API, not if
        # Jupyter infrastructure is warning free.
        # Though still show warnings by setting warning control to 'default'.
        export PYTHONWARNINGS='default'
        pytest --override-ini filterwarnings= tests/test_notebooks.py

Do you have any ideas why setting PYTHONWARNINGS='default' which will

print the first occurrence of matching warnings for each location (module + line number) where the warning is issued

would cause a nbclient.exceptions.DeadKernelError, which goes away if PYTHONWARNINGS is not set?

Log files

There is a log file for

$ PYTHONWARNINGS='default' pytest --override-ini filterwarnings= tests/test_notebooks.py -k test_xml_importexport &> /tmp/pythonwarnings_log.txt

at https://github.com/scikit-hep/pyhf/issues/1840#issuecomment-1089982787, which I can link here: https://github.com/scikit-hep/pyhf/files/8425002/pythonwarnings_log.txt

Related Issues and PRs

  • https://github.com/scikit-hep/pyhf/issues/1840
  • https://github.com/scikit-hep/pyhf/pull/1841

matthewfeickert avatar Apr 06 '22 08:04 matthewfeickert