Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run prostate-mri-lesion-seg on Colab #342

Closed
fedorov opened this issue Nov 29, 2023 · 6 comments
Closed

Unable to run prostate-mri-lesion-seg on Colab #342

fedorov opened this issue Nov 29, 2023 · 6 comments
Assignees

Comments

@fedorov
Copy link

fedorov commented Nov 29, 2023

@jtetrea trying to run this notebook https://github.com/Project-MONAI/research-contributions/blob/main/prostate-mri-lesion-seg/tutorial.ipynb on Google Colab leads to this error:

image

If this notebook is not expected to run on Colab, it would be nice to indicate the prerequisites/limitations in the opening paragraph.

But also it would be nice to make it work on Colab, since IMHO it is the easiest way to try things out quickly.

@jtetrea
Copy link
Contributor

jtetrea commented Dec 1, 2023

Thanks @fedorov for giving this a try. The notebook was not intended to be executed standalone on Colab. It references application code and so the full repository should be present and available.

Executing on Colab, just with the notebook, would be possible if some cells were added to write the application files locally throughout. This would be similar to other MONAI Deploy examples such as the segmentation app tutorial here. This would be possible and may be added in the future but for now the tutorial.ipynb should be used with full repository available locally.

@fedorov
Copy link
Author

fedorov commented Dec 1, 2023

Ok, thanks for the clarification.

This time I cloned the entire repository, downloaded model weights, and ran the command from the repo. This is the next error:

/content/research-contributions/prostate-mri-lesion-seg# monai-deploy package -l DEBUG -b nvcr.io/nvidia/pytorch:22.08-py3 ./prostate_mri_lesion_seg_app --tag lesion_seg_workflow_app:v1.0 -m prostate_mri_lesion_seg_app/models/
Traceback (most recent call last):
  File "/usr/local/bin/monai-deploy", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/monai/deploy/cli/main.py", line 120, in main
    execute_package_command(args)
  File "/usr/local/lib/python3.10/dist-packages/monai/deploy/packager/package_command.py", line 54, in execute_package_command
    packager_util.package_application(args)
  File "/usr/local/lib/python3.10/dist-packages/monai/deploy/packager/util.py", line 353, in package_application
    initialized_args = initialize_args(args)
  File "/usr/local/lib/python3.10/dist-packages/monai/deploy/packager/util.py", line 114, in initialize_args
    app_obj = get_application(args.application)
  File "/usr/local/lib/python3.10/dist-packages/monai/deploy/utils/importutil.py", line 80, in get_application
    vars = runpy.run_path(str(path))
  File "/usr/lib/python3.10/runpy.py", line 306, in run_path
    return _run_code(code, mod_globals, init_globals,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/content/research-contributions/prostate-mri-lesion-seg/prostate_mri_lesion_seg_app/__main__.py", line 57, in <module>
    from app import AIProstateLesionSegApp
  File "/content/research-contributions/prostate-mri-lesion-seg/prostate_mri_lesion_seg_app/app.py", line 60, in <module>
    from custom_lesion_seg_operator import CustomProstateLesionSegOperator
  File "/content/research-contributions/prostate-mri-lesion-seg/prostate_mri_lesion_seg_app/custom_lesion_seg_operator.py", line 66, in <module>
    import SimpleITK as sitk
ModuleNotFoundError: No module named 'SimpleITK'

So I manually installed SimpleITK, monai, pydicom and highdicom packages, which were missing. After that I hit the error below, which indicates that unfortunately it won't be possible to use this notebook in Colab, since it requires docker, which is not supported in Colab, and there are no plans to support it (see googlecolab/colabtools#299 (comment)).


[2023-12-01 22:39:42,108] [DEBUG] (app_packager) - Docker image build command: docker build -f './monai_tmpfscx20w_/dockerfile' -t lesion_seg_workflow_app:v1.0 './monai_tmpfscx20w_' --build-arg MONAI_UID=$(id -u) --build-arg MONAI_GID=$(id -g)
Building MONAI Application Package... /bin/sh: 1: docker: not found
[2023-12-01 22:39:42,136] [DEBUG] (app_packager) - 
Done

Thus, I am closing this issue. What I would like to be able to do is impossible.

@fedorov fedorov closed this as completed Dec 1, 2023
@jtetrea
Copy link
Contributor

jtetrea commented Dec 4, 2023

Thanks @fedorov. Yes, MONAI MAPs are containerized solutions for deployment of MONAI models. By the way, there are also some additional scripts in the repository, such as the scripts/local-test.sh script that executes the application code outside of the container (the other script executes within a MAP, but outside a Jupyter environment). Feel free to try that script if you have interest on Colab as it may circumvent the Docker issue.

@jtetrea jtetrea reopened this Dec 4, 2023
@jtetrea
Copy link
Contributor

jtetrea commented Dec 12, 2023

@fedorov were you able to try the offline test of the repository on Colab as suggested above? If not, no worries. I reopened the issue, but feel free to close at your discretion.

@fedorov
Copy link
Author

fedorov commented Dec 13, 2023

@jtetrea I do not have time to do this deep of an investigation. I still think having a notebook that works out of the box with Colab would significantly improve visibility and accessibility of this model. But it's not my project, and I can't make the time to work on fixing it. If you don't have interest/time either, please feel free to close this issue!

@jtetrea
Copy link
Contributor

jtetrea commented Dec 13, 2023

No problem. I agree that having a mechanism to work directly on Colab may improve accessibility for some users. We will consider this as we plan to create extensions and updates to this repository in the near future. Thanks!

@jtetrea jtetrea closed this as completed Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants