# Problem with image visualisation on jupyterlab 4.0.10

**URL:** <https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743>\
**Category:** Uncategorized\
**Created:** [July 2, 2024, 7:52am UTC](https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743 "2024-07-02T07:52:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nvkvc](https://discourse.itk.org/user_avatar/discourse.itk.org/nvkvc/32/4175_2.png) [@nvkvc](https://discourse.itk.org/u/nvkvc)\
**Post date:** [July 2, 2024, 7:52am UTC](https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743/1 "2024-07-02T07:52:56Z")

</div>

I have jupyterlab installed on docker image and I’ve also installed some additional libraries to the image like PyImageJ with ITKWidgets.  
However, when i try to visualise something using itk library I only got object printed, here’s the image:

 ![Screenshot 2024-07-02 at 09.33.16](https://discourse.itk.org/uploads/default/original/2X/6/6cf13c38bc81cd247ecc7e0aa50453ba24570719.png)

These are the version of a software installed on jupyter:

```auto
Selected Jupyter core packages...
IPython : 8.19.0
ipykernel : 6.28.0
ipywidgets : 8.1.3
jupyter_client : 8.6.0
jupyter_core : 5.7.0
jupyter_server : 2.12.2
jupyterlab : 4.0.10
nbclient : 0.8.0
nbconvert : 7.14.0
nbformat : 5.9.2
notebook : 7.0.6
qtconsole : not installed
traitlets : 5.14.1

```

And this is the content of my Dockerfile:

```auto
FROM quay.io/jupyter/minimal-notebook:2024-01-05@sha256:6943c4333439ea8f8db769b5a4bd862f2351477c878b40fb533aa4f89c896d5f 

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN mamba install --yes \
	'pyimagej' \
	'openjdk=8' \
	'ipywidgets' && \
    mamba clean --all -f -y 

RUN pip install --no-cache-dir 'itkwidgets[all]>=1.0a49'

RUN jupyter labextension enable imjoy-jupyterlab-extension
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager itk-jupyter-widgets

USER ${NB_UID}

WORKDIR "${HOME}"

```

Does anyone knows what might be the issue here?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [July 2, 2024, 1:19pm UTC](https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743/2 "2024-07-02T13:19:48Z")

</div>

@matt.mccormick and/or @PaulHax might be able to help.

---

<div class="post-metadata">

**Author:** ![PaulHax](https://discourse.itk.org/user_avatar/discourse.itk.org/paulhax/32/2949_2.png) [@PaulHax](https://discourse.itk.org/u/PaulHax)\
**Post date:** [July 2, 2024, 2:28pm UTC](https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743/3 "2024-07-02T14:28:50Z")

</div>

Please ensure `itkwidgets[all]>=1.0a53`. Version `1.0a50` is is needed for JuperterLab 4. More info:

> <https://github.com/Project-MONAI/tutorials/issues/1694#issuecomment-2061543131>
>
> \*\*Describe the bug\*\*
> Kernel hangs after itkwidgets visualization in jupyter not…ebook
> https://github.com/Project-MONAI/tutorials/blob/main/model\_zoo/TCIA\_PROSTATEx\_Prostate\_MRI\_Anatomy\_Model.ipynb
> 
> \*\*To Reproduce\*\*
> 1. docker pull projectmonai/monai:latest
> 2. create a new container
> 3. run into container
> 4. \`pip install 'itkwidgets\[notebook\]\>=1.0a49'\`
> \`\`\`
> from monai.transforms import LoadImage
> root\_dir = "/opt/monai/workspace/Data"
> data\_dir = os.path.join(root\_dir, "Task09\_Spleen")
> train\_images = sorted(glob.glob(os.path.join(data\_dir, "imagesTr", "\*.nii.gz")))
> out = LoadImage(ensure\_channel\_first=True)(train\_images\[0\])
> view(image=out)
> \`\`\`
> 
> \*\*Expected behavior\*\*
> Kernal will not hangs after using view.
> 
> \*\*Screenshots\*\*
> \<img width="594" alt="Screen Shot 2024-04-17 at 15 46 44" src="https://github.com/Project-MONAI/tutorials/assets/55491388/7f0a0638-786b-4c8d-bfd4-ddabb94c6ed7"\>
> 
> \*\*Additional context\*\*
> \- Look similar to this one:
> https://github.com/InsightSoftwareConsortium/itkwidgets/issues/688
> \- After install \`itkwidgets\[notebook\]\>=1.0a49\`, look like there will be a requirement compatibility issues for pandas, not sure whether it's related the issue.
> \`\`\`
> Collecting pandas\>=2.0.0 (from dask-image-\>ngff-zarr\[dask-image\]\>=0.4.3-\>itkwidgets\>=1.0a49-\>itkwidgets\[notebook\]\>=1.0a49)
> Downloading pandas-2.2.2-cp310-cp310-manylinux\_2\_17\_x86\_64.manylinux2014\_x86\_64.whl.metadata (19 kB)
> \`\`\`
> \`\`\`
> ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
> cudf 24.2.0 requires pandas\<1.6.0dev0,\>=1.3, but you have pandas 2.2.2 which is incompatible.
> dask-cuda 24.2.0 requires pandas\<1.6.0.dev0,\>=1.3, but you have pandas 2.2.2 which is incompatible.
> dask-cudf 24.2.0 requires pandas\<1.6.0dev0,\>=1.3, but you have pandas 2.2.2 which is incompatible.
> \`\`\`
> \- After install the itkwidgets and exiting the Jupyter notebook, trying to launch the notebook again leads to a configuration error. It appears that the installation of itkwidgets is causing a disruption in the configuration settings.
> \<img width="1490" alt="Screen Shot 2024-04-17 at 15 51 33" src="https://github.com/Project-MONAI/tutorials/assets/55491388/c4d909d4-f6de-4ff5-8e3c-66b9fd4c94ff"\>

(Thanks for the ping dzenanz)

---

<div class="post-metadata">

**Author:** ![nvkvc](https://discourse.itk.org/user_avatar/discourse.itk.org/nvkvc/32/4175_2.png) [@nvkvc](https://discourse.itk.org/u/nvkvc)\
**Post date:** [July 2, 2024, 4:22pm UTC](https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743/4 "2024-07-02T16:22:35Z")

</div>

> [@PaulHax](#):
>
> 1.0a53

Thanks Paul and Dzenan for your quick response. However bumping itkwidgets to 1.0a53 version didn’t fix the issue. This is what I got printed on console when I run test from my first comment:

```auto
Jul 02, 2024 4:18:44 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
ImageJ2 version: 2.15.0/1.54f
[INFO] Populating metadata
WARNING:imagej:Operating in headless mode - the original ImageJ will have limited functionality.
<itkwidgets.viewer.Viewer at 0x7f2ecad20350>

```

Do you maybe have any other idea what might cause this issue? Should I provide some more information to you?

---

<div class="post-metadata">

**Author:** ![PaulHax](https://discourse.itk.org/user_avatar/discourse.itk.org/paulhax/32/2949_2.png) [@PaulHax](https://discourse.itk.org/u/PaulHax)\
**Post date:** [July 3, 2024, 2:01pm UTC](https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743/5 "2024-07-03T14:01:40Z")

</div>

Shucks. Upgrading the version was my one good idea =/

You could check the browser’s Javascript console (F12) to see if there is anything suspicioius.

@matt.mccormick may have a better idea.

---

<div class="post-metadata">

**Author:** ![PaulHax](https://discourse.itk.org/user_avatar/discourse.itk.org/paulhax/32/2949_2.png) [@PaulHax](https://discourse.itk.org/u/PaulHax)\
**Post date:** [July 3, 2024, 2:29pm UTC](https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743/6 "2024-07-03T14:29:12Z")

</div>

I ran the itkwidgets [Hello3DWorld.ipynb](https://github.com/InsightSoftwareConsortium/itkwidgets/blob/main/examples/Hello3DWorld.ipynb) with your docker file and it worked. Hmmm.

 ![image](https://discourse.itk.org/uploads/default/original/2X/0/01696e881a5272456e988db1391fbfd4995a4bab.png)

---

<div class="post-metadata">

**Author:** ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)\
**Post date:** [July 23, 2024, 3:47am UTC](https://discourse.itk.org/t/problem-with-image-visualisation-on-jupyterlab-4-0-10/6743/7 "2024-07-23T03:47:57Z")

</div>

> [@nvkvc](#):
>
> ```auto
> RUN jupyter labextension enable imjoy-jupyterlab-extension
> RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager itk-jupyter-widgets
> 
> ```

These lines should probably be removed, which likely bring in old, incompatible dependencies.
