populse / populse_mia

Multiparametric Image Analysis
Other
10 stars 9 forks source link

[casa_distro virtualisation] unit tests are failing in the Singularity container #285

Open servoz opened 2 years ago

servoz commented 2 years ago

Exactly, the test.TestMIAMainWindow.test_open_shell test, and only on the BV Singularity container (not for host installation).

Exceptions / messages:

test_open_shell (__main__.TestMIAMainWindow)
Opens a Qt console and kill it afterwards. ... startShell
run_ipconsole_kernel: qtconsole
<frozen importlib._bootstrap>:914: ImportWarning: QtImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: QtImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: QtImporter.find_spec() not found; falling back to find_module()
runing IP console kernel
/usr/local/lib/python3.10/dist-packages/ipykernel/kernelapp.py:465: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
  zmq_ioloop.install()
/usr/local/lib/python3.10/dist-packages/ipykernel/kernelapp.py:305: DeprecationWarning: IPython.utils.io.raw_print has been deprecated since IPython 7.0
  io.raw_print(_ctrl_c_message)
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049

/usr/local/lib/python3.10/dist-packages/ipykernel/kernelapp.py:307: DeprecationWarning: IPython.utils.io.raw_print has been deprecated since IPython 7.0
  io.raw_print(line)
To connect another client to this kernel, use:
    --existing kernel-29556.json
servoz commented 2 years ago

Without having really had time to look into the details, here is what is observed for "jupyter qtconsole" in mia (File > Open python shell):

Screenshot from 2022-09-06 18-02-43

startShell
run_ipconsole_kernel: qtconsole
runing IP console kernel
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049

To connect another client to this kernel, use:
    --existing kernel-62384.json

But, no problem with UTs.

Screenshot from 2022-09-06 18-11-45

startShell
run_ipconsole_kernel: qtconsole
runing IP console kernel
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049

To connect another client to this kernel, use:
    --existing kernel-63300.json
QCoreApplication::exec: The event loop is already running

But in this case, the UTs fail, or more precisely stop (nothing happens anymore) in the test.TestMIAMainWindow.test_open_shell with:

test_open_shell (__main__.TestMIAMainWindow)
Opens a Qt console and kill it afterwards. ... startShell
run_ipconsole_kernel: qtconsole
<frozen importlib._bootstrap>:914: ImportWarning: QtImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: QtImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: QtImporter.find_spec() not found; falling back to find_module()
runing IP console kernel
/usr/local/lib/python3.10/dist-packages/ipykernel/kernelapp.py:465: DeprecationWarning: zmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.
  zmq_ioloop.install()
/usr/local/lib/python3.10/dist-packages/ipykernel/kernelapp.py:305: DeprecationWarning: IPython.utils.io.raw_print has been deprecated since IPython 7.0
  io.raw_print(_ctrl_c_message)
NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.

To exit, you will have to explicitly quit this process, by either sending
"quit" from a client, or using Ctrl-\ in UNIX-like environments.

To read more about this, see https://github.com/ipython/ipython/issues/2049

/usr/local/lib/python3.10/dist-packages/ipykernel/kernelapp.py:307: DeprecationWarning: IPython.utils.io.raw_print has been deprecated since IPython 7.0
  io.raw_print(line)
To connect another client to this kernel, use:
    --existing kernel-63432.json
denisri commented 2 years ago

Unfortunately the ipyhton/jupyter console integration in a running python kernel is very very unstable. It is an undocumented feature that used to work, but is not explicitly maintained. In recent systems it is mostly broken, and I could make it work only in a very precise combination of versions of jupyter, ipython, qtconsole, tornado and a bunch of other modules. A nightmare. So I suppose this feature will have to disappear sooner or later, but it is very very useful for debugging or experimenting things, so as long as I can make it work, I like to have it. But, unfortunately also, I could not make a test to know if it works or not: when it does not, things just hang. It's really a pity that this is not an officially maintained feature, because it's really helpful.

servoz commented 2 years ago

Thank you for your answer @denisri. I have to admit that I don't know this (and I never use Jupyter, I'm a bit ashamed :-))). @patafana should take a look at it if he has time (I don't have time to do it at the moment). From what you say, maybe he doesn't need to look at it? What bothers me a bit is that at the moment the unit tests are working for a wrong reason. On the host, it doesn't work and consequently the unit tests work correctly. In casa_distro, it works and as a result the tests crash (it stays stuck at test.TestMIAMainWindow.test_open_shell) ...