populse / populse_mia

Multiparametric Image Analysis
Other
10 stars 9 forks source link

anatomist_2 viewer is not available or not working #322

Closed servoz closed 10 months ago

servoz commented 10 months ago

anatomist_2 viewer no longer works. I haven't looked into this issue yet, but I think it's due to the recent change made to avoid writing pyscript.m files to the project root (changing the current directory to a temporary directory).

anatomist_2 viewer is not available or not working ...!
Traceback:
  File "/casa/home/Git_projects/populse_mia/populse_mia/user_interface/data_viewer/data_viewer_tab.py", line 140, in load_viewer
    self.viewers_loaded[viewer_name] = viewer_module.MiaViewer(
  File "/casa/home/Git_projects/populse_mia/populse_mia/user_interface/data_viewer/anatomist_2/mia_anatomist.py", line 70, in __init__
    self.anaviewer = AnaSimpleViewer2(init_global_handlers)
  File "/casa/home/Git_projects/populse_mia/populse_mia/user_interface/data_viewer/anatomist_2/anasimpleviewer2.py", line 183, in __init__
    os.chdir(mainwindowdir)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpzgpk1lrg/user_interface/data_viewer/anatomist_2'
denisri commented 10 months ago

It's because anasimpleviewer2 starts from the current directory and adds the path user_interface/data_viewer/anatomist_2, which supposes that the CWD is in the root source dir of populse_mia (which I find quite strange, we are usually not here). So yes it's a consequence of the change for pyscript.m because your fix was to chdir to a temp directory at startup. But:

servoz commented 10 months ago

Exactly, I'm looking at this ticket right now! The fix shouldn't be too complicated.

servoz commented 10 months ago

the pyscript.m problem was also solved by https://github.com/populse/capsul/commit/e64de08460fe346581460eeafb0426be163205a8 (I hope) so maybe doesn't need to chdir to a temp any longer (to be tested from Mia side)

Following your commit (https://github.com/populse/capsul/commit/e64de08460fe346581460eeafb0426be163205a8), I ran few tests (which I've already forgotten about, but which I can run again) to remove the previous commits ( 188c79b and populse/capsul@751b88c) for changing working directories to a temporary directory (because there's no point in keeping commits that produce the same thing, especially as in practice this amounts to changing from one temporary directory to another temporary directory ...).

This tests indicated that deleting the 2 previous commits and keeping the last (https://github.com/populse/capsul/commit/e64de08460fe346581460eeafb0426be163205a8) wasn't enough to fix the pyscript.m issue on our side, so I didn't deleted the 2 previous commits in this regard. Anyway, I don't think it's particularly problematic to be in a temporary directory to launch mia.

However, what worries me a little is that as there is no longer any synchronization between master (V2) and the V3 branch, the improvements we are currently making in V2 (master) will certainly be lost in V3 ...

servoz commented 10 months ago

I initially thought of using capsul_config (in cc['engine']['global']['capsul.engine.module.python']['python']['path'] we can find the root of the populse_mia used) but your idea of using the __file__ is simpler and therefore better!!!! I'll use this idea ... :-)

denisri commented 10 months ago

This tests indicated that deleting the 2 previous commits and keeping the last (populse/capsul@e64de08) wasn't enough to fix the pyscript.m issue on our side

So the fix on capsul side is not complete... Too bad... We still have to find something because the distributed execution will likely also write these files everywhere.

However, what worries me a little is that as there is no longer any synchronization between master (V2) and the V3 branch, the improvements we are currently making in V2 (master) will certainly be lost in V3 ...

Same for me, but branches have completely diverged, it's impossible to merge automatically, we would need to report manually every change from master to 3.0. That's why I want to switch to 3.0 as quickly as possible and completely drop 2.x. Maintaining both is too much work.

servoz commented 10 months ago

Before switching to V3 (master) and dropping 2.x, please let me know, we'll need just before to make a last release of capsul 2.x (certainly also populse_db) on pypi so we can continue with Mia V2 while waiting to go to V3!!

denisri commented 10 months ago

Yes sure, but we're not completely there yet... and anyway we have to port Mia to Capsul3 before we drop Capsul2. By now there are a few tools missing.