Skip to content

Mantid logs appearing in Jupyter notebook cells #36275

@rbauststfc

Description

@rbauststfc

Original reporter: Andrew and Christy from the POLREF instrument at ISIS. They have asked to be kept up to date on progress with this.

Describe the bug

In the last cycle, when using the Mantid 6.7 kernel in IDAaaS (Jupyterlab in Jupyter environment), the logging that appears in the terminal is now also appearing in the cell output. This issue can be replicated simply by running the following command in a Jupyter notebook cell:

from mantid.simpleapi import *

In order to try and work out why this is happening Andrew has run a few tests and provided the following information:

Firstly, when using the Mantid 6.6 kernel in IDAaaS, the issue is not there, and it behaves as expected - only python printouts are sent to the cell output and the logging is only in the terminal.

Interestingly, when I use one of my own conda environments on IDAaaS (I have a separate miniconda install for development work), with what I believe is a newer version of Jupyter than potentially what is being used in the 6.6 IDAaaS Kernel (and with an older version of Mantid 6.4), the logging issue appears. Again, I believe this didn't used to happen with this environment, however, I can't confirm if jupyter in the environment had been updated or something in the background in IDAaaS has been updated.

Finally, when using a conda environment with Mantid 6.7 in windows with a very recent version of Jupyter, it all seems fine - i.e. no logging issues and things working as expected.

From this, it seems something has changed with the way IDAaaS interacts with Jupyterlab such that either certain versions of Jupyterlab or the way it is configured, needs to be different than it was before so that the logging works correctly.

IDAaaS support have done some investigation into this and haven't yet been able to find anything obvious. They asked us to test if this issue occurs on a Linux system other than IDAaaS, so I tested on a Linux ubuntu-focal-20.04 instance on STFC cloud. I found that if I conda install Mantid 6.7 and try to run it in the latest (pip installed) version of Jupyter notebooks then I see the logs in the notebook. If I do the same with Mantid 6.6 then I don't see the issue. It would be good to investigate this further to see if we can explain the difference.

Note that it's possible to change the logging behaviour in Mantid (see https://docs.mantidproject.org/v6.7.0/concepts/PropertiesFile.html#logging-properties) but neither Andrew or myself have been able to get any of these settings to stop the logs printing to the Jupyter notebook.

To Reproduce

  1. Conda install Mantid 6.7.
  2. Pip install Jupyter notebooks into the conda environment.
  3. Open Jupyter notebooks, start a new notebook and in the first cell type from mantid.simpleapi import *. The log information should be printed in the notebook. You can also see the effect if, after importing the simpleapi, you call DownloadInstrument() from a cell too.

Expected behavior

The logs appear only in the terminal, not in the Jupyter notebook.

Platform/Version (please complete the following information):

  • OS: Linux, IDAaaS. It could be handy to check the behaviour on Mac.
  • Mantid Version 6.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIssues and pull requests that are regressions or would be considered a bug by users (e.g. crashing)ISIS: CoreIssue and pull requests at ISIS that relate to Core features and functionsISIS: LSSIssue and pull requests relating to SANS and Reflectometry (Large Scale Structures) at ISIS

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions