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

[BUG] App SDK v0.6 Packager fails to build MAP, if a Wheel is NOT provided on the commandline #453

Closed
MMelQin opened this issue Sep 21, 2023 · 4 comments · Fixed by #481
Closed
Assignees
Labels
bug Something isn't working

Comments

@MMelQin
Copy link
Collaborator

MMelQin commented Sep 21, 2023

Describe the bug

Note: a workaround is provided at the end of the bug report.

With MONAI Deploy App SDK v0.6, when packaging an application using the monai-deploy package command with only the specified mandatory arguments, e.g. monai-deploy package simple_imaging_app -c simple_imaging_app/app.yaml -t simple_app:1.0 --platform x64-workstation , the packager fails with the follow error:

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref y8uxyvatmaopuhvxtrc49hyqj::owxhqwev8q82fnss9a02pnx2q: "/None": not found

More detailed log would show Docker build error, e.g.

#22 [16/21] COPY ./None /tmp/None
#22 ERROR: failed to calculate checksum of ref y8uxyvatmaopuhvxtrc49hyqj::owxhqwev8q82fnss9a02pnx2q: "/None": not found
------
 > [16/21] COPY ./None /tmp/None:
------
Dockerfile:78
--------------------
  76 |     
  77 |     # Copy user-specified MONAI Deploy SDK file
  78 | >>> COPY ./None /tmp/None
  79 |     RUN pip install /tmp/None
  80 |     

Steps/Code to reproduce bug

Easiest is to run one of the Jupyter notebook in the example and watch the App Packaging steps.

Expected behavior

The Packager is expected to pip install monai-deploy-app-sdk from pypi,org, but it has a bug in detecting that monai-deploy-app-sdk Wheel file is NOT provided and still enforces to copy and install the App SDK with the non-existent Wheel file.

Environment details (please complete the following information)

  • OS/Platform: Ubuntu 20.04 LTS
  • Python Version: 3.8.10
  • Method of MONAI Deploy App SDK install: [pip, conda]
  • SDK Version: 0.6

Workaround

The workarounds are known, and the simplest one is to download the monai-deploy-app-sdk Python Wheel file, and provide it when running the Packager (add -l DEBUG to see detailed output), e.g.

monai-deploy package simple_imaging_app -c simple_imaging_app/app.yaml -t simple_app:1.0 --platform x64-workstation --monai-deploy-sdk-file monai_deploy_app_sdk-0.6.0-py3-none-any.whl

To download the App SDK Wheel file

  • In the browser, navigate to https://pypi.org/project/monai-deploy-app-sdk/#files
  • Find the .whl file under the section Built Distribution, monai_deploy_app_sdk-0.6.0-py3-none-any.whl,
  • Click the file to start downloading
  • Locate the downloaded .whl file and note its full path for use during packaging
  • Alternative way to the above steps is to use wget https://files.pythonhosted.org/packages/67/df/414c50600c56de434df8a794fadecddad42fcad46f1d6b162c795d54a376/monai_deploy_app_sdk-0.6.0-py3-none-any.whl

Advanced Workaround

  • pip install monai-deploy-app-sdk
  • Locate the installed Holoscan SDK source file in the site-packages folder, i.e. ~/.local/lib/python3.8/site-packages/holoscan/cli/packager/parameters.py
  • Open the above file in a text editor
  • On line 106, find self._data["monai_deploy_sdk_filenamename"]. Replace namename with name, and save the file.
  • Once the above is done, the Packager should work with only the mandatory arguments and will be able to properly pip install the App SDK in the MAP image.

Additional context

A patch release should be released to fix the simple issue in the Packager.

@MMelQin MMelQin added the bug Something isn't working label Sep 21, 2023
@MMelQin MMelQin self-assigned this Sep 21, 2023
@MMelQin MMelQin changed the title [BUG] App SDK v0.6 Packager fails to build MAP [BUG] App SDK v0.6 Packager fails to build MAP, if a Wheel is NOT provided on the commandline Sep 30, 2023
@jordimassaguerpla
Copy link

You can also use pip download. With pip download, you can specify the python version to use, and the version of the wheel to download. It can easily be that the host where you run pip does not have the same python version than the one inside the container, so it is very useful.

You can see an example here, where we use python3.9 to download the wheel for python3.8

https://github.com/Project-MONAI/monai-deploy-app-sdk/compare/main...jordimassaguerpla:monai-deploy-app-sdk:add_build_and_push_workflow4?expand=1#diff-710503ae696552592f60ebb90a34083e5d0c857aa0ab9535760c660f1915c140R86

@MMelQin
Copy link
Collaborator Author

MMelQin commented Nov 28, 2023

You can also use pip download. With pip download, you can specify the python version to use, and the version of the wheel to download. It can easily be that the host where you run pip does not have the same python version than the one inside the container, so it is very useful.

You can see an example here, where we use python3.9 to download the wheel for python3.8

https://github.com/Project-MONAI/monai-deploy-app-sdk/compare/main...jordimassaguerpla:monai-deploy-app-sdk:add_build_and_push_workflow4?expand=1#diff-710503ae696552592f60ebb90a34083e5d0c857aa0ab9535760c660f1915c140R86

Thanks for the input, though this defect is caused by a minor coding error, detailed in the workaround, rather than mechanism/workflow.

@KyteProject
Copy link

Thanks for detailing the workaround. In the context of following the instructions on the example app in jupyter I just added a cell before the deployment command with:

from urllib.request import urlretrieve
urlretrieve("https://files.pythonhosted.org/packages/67/df/414c50600c56de434df8a794fadecddad42fcad46f1d6b162c795d54a376/monai_deploy_app_sdk-0.6.0-py3-none-any.whl","simple_imaging_app/monai_deploy_app_sdk-0.6.0-py3-none-any.whl")

then used the updated command above to deploy:

tag_prefix = "simple_imaging_app"

!monai-deploy package simple_imaging_app -c simple_imaging_app/app.yaml -t {tag_prefix}:1.0 --platform x64-workstation --monai-deploy-sdk-file simple_imaging_app/monai_deploy_app_sdk-0.6.0-py3-none-any.whl -l DEBUG

Allowing me to continue following the steps and keeping it contained in the notebook.

@MMelQin
Copy link
Collaborator Author

MMelQin commented Jan 23, 2024

Thanks a lot for making it transparent to the users!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants