Import errors when using `tasks._registration_utils.py` without `fractal-tasks` extra
tcompa opened this issue · 0 comments
tcompa commented
scMultiplex has this import: from fractal_tasks_core.tasks._registration_utils import create_well_acquisition_dict
from the fractal_tasks_core.tasks
subpackage.
Because it imports from fractal_tasks_core.tasks
, we are expecting that the fractal-tasks-core[fractal-tasks]
extra was included, but scMultiplex does not require it:
[options.extras_require]
fractal-tasks =
anndata
fractal-tasks-core==1.0.2
For this reason, scmultiplex imports from fractal_tasks_core.tasks
may fail (e.g. due to the missing image_registration
module, see #793 (comment).
How should we proceed?
- #531 would clearly solve the problem, by making it explicit that you cannot import from
tasks
if you don't have the corresponding extra - but I don't think it's an easy solution. - We ask scMultiplex to install the
fractal-tasks
extra. This is quite bad, since they'll have to include a lot of heavy dependencies. - We move relevant functions (e.g.
create_well_acquisition_dict
) to the core-library, where no special imports are needed. - We mitigate the issue by deferring imports as much as possible, so that we reduce the risk of someone hitting a
ModuleNotFoundError
when importing some helper functions. An example of this solution is to movechi2_shift_out
to a separate module, which scMultiplex will likely not import from.