Neubias-WG5 / W_NucleiSegmentation-Cellpose

Apache License 2.0
0 stars 1 forks source link

Dockerfile not working locally #1

Open TorecLuik opened 1 year ago

TorecLuik commented 1 year ago

If you run locally, it will complain about 'no such file or directory: /app/descriptor.json'.

You have fixed this for the ImageJ example, but not for the others: https://github.com/Neubias-WG5/W_NucleiSegmentation-ImageJ/blob/master/Dockerfile

# for running the wrapper locally
ADD descriptor.json /app/descriptor.json
TorecLuik commented 1 year ago

Oh I see it is in master, just not in the released version! So if we pull the image it still fails, but we just need a new release.

volker-baecker commented 1 year ago

Hi @TorecLuik,

I created the new release, so please go ahead. Someone with admin access might need to refresh to make it appear in the BIAFLOWS web-app.

TorecLuik commented 1 year ago

Hey @volker-baecker,

Thanks. That worked.

However, now there is a new bug when running the wrapper.py:

Traceback (most recent call last):

File "wrapper.py", line 11, in from biaflows.helpers import BiaflowsJob, prepare_data, upload_data, upload_metrics, get_discipline File "/usr/local/lib/python3.7/site-packages/biaflows/helpers/init.py", line 3, in from .metric_upload import upload_metrics File "/usr/local/lib/python3.7/site-packages/biaflows/helpers/metric_upload.py", line 11, in from biaflows.metrics import computemetrics_batch File "/usr/local/lib/python3.7/site-packages/biaflows/metrics/init.py", line 3, in from .compute_metrics import computemetrics, computemetrics_batch File "/usr/local/lib/python3.7/site-packages/biaflows/metrics/compute_metrics.py", line 41, in from .skl2obj import * File "/usr/local/lib/python3.7/site-packages/biaflows/metrics/skl2obj.py", line 2, in from skan import csr File "/usr/local/lib/python3.7/site-packages/skan/init.py", line 1, in from .csr import skeleton_to_csgraph, branch_statistics, summarize, Skeleton File "/usr/local/lib/python3.7/site-packages/skan/csr.py", line 21, in @numba.jitclass(csr_spec) AttributeError: module 'numba' has no attribute 'jitclass'

This seems like a python package mismatch, similar to https://github.com/aertslab/pySCENIC/issues/245

However, I cannot pip install stuff inside the singularity container, so I can't test whether downgrading helps.

Not sure whether this is an issue with this specific container, or with the biaflows python package in general?

TorecLuik commented 1 year ago

I tested creating my own dockerfile with a lower numba version (0.50.0) and then it seems to run into issues with cellpose: "no module named importlib.metadata". So that doesn't seem to be the solution for this container

volker-baecker commented 1 year ago

Hi @TorecLuik, can you try and install importlib.metadata? pip install importlib-metadata

TorecLuik commented 1 year ago

It is already installed (6.0.0). So it just says requirement already satisfied.

TorecLuik commented 1 year ago

I think the main issue is that cellpose is not pinned to a specific version in this dockerfile. This post explains similar issues: https://pythonspeed.com/articles/dockerizing-python-is-hard/

That means that the new cellpose (2.2) will get picked up if you build it now, but that is not compatible with Python 3.7 or the other required packages. Which is why we are seeing all these package issues now. What version were you running when you built this initially? Should probably also fix imageio to the correct version then.

I found that cellpose 0.7.2 already requires Python 3.8 (https://github.com/MouseLand/cellpose/issues/376 ). So, 0.6.1 then? Fixing to 0.6.1 seems to work for me.

This might also be an issue for other W_ containers then?

volker-baecker commented 1 year ago

Hi @TorecLuik, yes you are right, all versions should be pinned to a specific version. That was our intention, so we should correct this wherever it is not the case.
Thanks, I'll change it to 0.6.1.

volker-baecker commented 1 year ago

What about imageio? Although it might not be a problem now we should also used a fixed version. Which one? The latest?

TorecLuik commented 1 year ago

I'm not sure. It seems to work with the current version in my scenario, but perhaps someone can look at the old image (e.g. perhaps that still runs on the biaflows server?) and 'pip list' to see the version(s) used there?

TorecLuik commented 1 year ago

I have changed a bit in the wrapper, so I will keep my fork, but I have found that these fixed numbers work locally:

RUN pip install imageio==2.9.0 RUN pip install cellpose==0.6.1 RUN pip install numpy==1.19.4 RUN pip install numba==0.50.1

However, probably better to fold it into 1 RUN command.

Then we can close this issue