imagej / imagej/pyimagej

Indefinite hanging when trying to intialize pyimagej with `ij = imagej.init()`

Open
#214 2 comments 0 reactions 0 assignees View on GitHub
tech-support
Dominant language
Python
Stars
534
Forks
95
PR merge metrics
No merged PRs in 30d

Description

I'm having some issues with initialization in a Docker container. `ij = imagej.init()` will hang indefinitely. I have not been successful yet in getting it to initialize. Here are the debug statements that I see

```
=> [8/8] RUN python /opt/fiji/init_fiji.py 906.0s
=> => # Returning expanded coordinate io.scif:scifio-labeling:0.3.1.
=> => # Returning expanded coordinate net.imglib2:imglib2-imglyb:1.0.1.
=> => # First time start-up may be slow. Downloaded dependencies will be cached for shorter start-up time
=> => # s in subsequent executions.
=> => # Executing: ('/opt/conda/bin/mvn', '-B', '-f', '/root/.jgo/io.scif/scifio-labeling/0.3.1/eb3228841
=> => # e43c0aa0cffa924ea6aa524384a3685113d54510c0ed985c20d2ab0/pom.xml', 'dependency:resolve')
```

Here is my Dockerfile:

```
FROM --platform=linux/amd64 continuumio/miniconda3:4.11.0

ENV CONDA_DIR=/opt/conda
ENV JAVA_HOME=/opt/conda/jre

RUN conda install mamba -n base -c conda-forge

RUN mamba install openjdk=8 pyimagej unzip \
-c conda-forge -y &&\
mamba clean --all -f -y

RUN mamba create -n pyimagej -c conda-forge pyimagej openjdk=8 unzip

WORKDIR /opt/fiji

RUN wget -q https://downloads.imagej.net/fiji/latest/fiji-linux64.zip \
&& unzip fiji-linux64.zip \
&& rm fiji-linux64.zip

ENV PATH $PATH:/opt/fiji/Fiji.app

COPY init_fiji.py .
RUN python /opt/fiji/init_fiji.py
```
And here is the `init_fiji.py` script:
```
import imagej
import imagej.doctor

imagej.doctor.debug_to_stderr()
ij = imagej.init("/opt/fiji/Fiji.app")
print(f"ImageJ version: {ij.getVersion()}")
```

If I swap `ij = imagej.init("/opt/fiji/Fiji.app")` for `ij = imagej.init()`, these are the debug statemetns I get:

```
=> [8/8] RUN python /opt/fiji/init_fiji.py 69.7s
=> => # Returning expanded coordinate net.imglib2:imglib2-imglyb:1.0.1.
=> => # First time start-up may be slow. Downloaded dependencies will be cached fo
=> => # r shorter start-up times in subsequent executions.
=> => # Executing: ('/opt/conda/bin/mvn', '-B', '-f', '/root/.jgo/net.imagej/image
=> => # j/RELEASE/bf9da2ebe6c78d8bd105a97ce32adcfe853ce5e97dd621b9e35936d1c6abf90c
=> => # /pom.xml', 'dependency:resolve')
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Dockerfile and /opt/fiji/init_fiji.py, then reproduce the RUN python /opt/fiji/init_fiji.py step with imagej.doctor.debug_to_stderr() enabled. Compare imagej.init() with imagej.init("/opt/fiji/Fiji.app") and inspect the dependency-resolution output. Done means initialization completes and prints the ImageJ version instead of hanging.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, python
Domain
devops, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.