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

Bootstrapping IPM from artifact ignores requirements.txt #698

Open
isc-shuliu opened this issue Jan 9, 2025 · 6 comments · Fixed by #719
Open

Bootstrapping IPM from artifact ignores requirements.txt #698

isc-shuliu opened this issue Jan 9, 2025 · 6 comments · Fixed by #719
Assignees
Labels
bug Something isn't working prio: high
Milestone

Comments

@isc-shuliu
Copy link
Collaborator

During recent meetings with Eric (from IPE) and @isc-jili , we discovered that when loading the installer artifact of IPM 0.10.0 (e.g., zpm-0.10.0-beta.3.xml) on a fresh iris instance, the python requirements.txt is ignored, causing all import oras calls to fail.

However, manually installation from source code works fine. Namely,

do $System.OBJ.Load("/<ipm-repo-root>/preload/cls/IPM/Installer.cls","ck")
do ##class(IPM.Installer).setup("/<ipm-repo-root>/", 3)

Something in the bootstrap process is missing.

@isc-shuliu isc-shuliu added bug Something isn't working prio: high labels Jan 9, 2025
@isc-shuliu isc-shuliu added this to the Backlog milestone Jan 9, 2025
@isc-shuliu isc-shuliu self-assigned this Jan 9, 2025
@isc-shuliu isc-shuliu changed the title Loading IPM installer artifact doens't install requirements.txt (only containing oras for now) Bootstrapping IPM from artifact ignores requirements.txt Jan 9, 2025
@isc-shuliu
Copy link
Collaborator Author

The artifacts, e.g. zpm-0.10.0-beta.3.xml, do not contain any information from requirements.txt (as expected).

Unless there's a way to attach arbitrary files into the xml artifact, we may need to hard code the python dependency installation into the code if we want to keep using the .xml artifact for one-liner installation.

@isc-kiyer
Copy link
Collaborator

@isc-shuliu This got me thinking about what would happen in an environment that has no internet access. How would it install python dependencies? Could the oras python package be packaged up at time of publishing the zpm artifact? Also, unrelated note but if we are changing the artifact type from xml, perhaps also rename it to ipm?

cc @isc-tleavitt @isc-eneil @isc-jili @isc-jlechtne

@isc-kiyer
Copy link
Collaborator

Useful post for downloading python packages for packaging into IPM distributable: https://stackoverflow.com/questions/49333152/copy-installed-packages-using-pip-to-another-environment

@isc-tleavitt isc-tleavitt modified the milestones: Backlog, January 2025 Jan 14, 2025
@isc-shuliu isc-shuliu linked a pull request Jan 29, 2025 that will close this issue
5 tasks
@isc-eneil
Copy link
Collaborator

isc-eneil commented Jan 30, 2025

@isc-shuliu The work-around mentioned is not working for me (when trying with stakeholder devs). I was on a 0.10.0-beta.11 version and tried loading from the source code zip file on the Releases page. It fails when it hits the reload phase and tries to load requirements.txt with this error:

[USER|ZPM] Initialize SUCCESS
[USER|ZPM] Reload START (/Users/jlou/Downloads/ipm-0.10.0-beta.11/)
[USER|zpm] requirements.txt START
[USER|zpm] requirements.txt FAILURE
[ZPM] Reload FAILURE
ERROR! ObjectScript error: InstallPythonRequirements+25^%IPM.Lifecycle.Base.1 *Failed to Load Python: Check documentation and messages.log, Check CPF parameters:[PythonRuntimeLibrary,PythonRuntimeLibraryVersion], Check sys.path setup in: $INSTANCE/lib/python/iris_site.py2025-01-30 15:38:23 0 IPM.Installer: ERROR #5002: ObjectScript error: InstallPythonRequirements+25^%IPM.Lifecycle.Base.1 *Failed to Load Python: Check documentation and messages.log, Check CPF parameters:[PythonRuntimeLibrary,PythonRuntimeLibraryVersion], Check sys.path setup in: $INSTANCE/lib/python/iris_site.py
2025-01-30 15:38:23 0 IPM.Installer: Installation failed at 2025-01-30 15:38:23
2025-01-30 15:38:23 0 %Installer: Elapsed time 2.66866s

@isc-shuliu
Copy link
Collaborator Author

@isc-shuliu The work-around mentioned is not working for me (when trying with stakeholder devs). I was on a 0.10.0-beta.11 version and tried loading from the source code zip file on the Releases page. It fails when it hits the reload phase and tries to load requirements.txt with this error:

[USER|ZPM] Initialize SUCCESS [USER|ZPM] Reload START (/Users/jlou/Downloads/ipm-0.10.0-beta.11/) [USER|zpm] requirements.txt START [USER|zpm] requirements.txt FAILURE [ZPM] Reload FAILURE ERROR! ObjectScript error: InstallPythonRequirements+25^%IPM.Lifecycle.Base.1 *Failed to Load Python: Check documentation and messages.log, Check CPF parameters:[PythonRuntimeLibrary,PythonRuntimeLibraryVersion], Check sys.path setup in: $INSTANCE/lib/python/iris_site.py2025-01-30 15:38:23 0 IPM.Installer: ERROR #5002: ObjectScript error: InstallPythonRequirements+25^%IPM.Lifecycle.Base.1 *Failed to Load Python: Check documentation and messages.log, Check CPF parameters:[PythonRuntimeLibrary,PythonRuntimeLibraryVersion], Check sys.path setup in: $INSTANCE/lib/python/iris_site.py 2025-01-30 15:38:23 0 IPM.Installer: Installation failed at 2025-01-30 15:38:23 2025-01-30 15:38:23 0 %Installer: Elapsed time 2.66866s

Does your instance have embedded python enabled? It seems the error stems from this line

Set tSysModule = ##class(%SYS.Python).Import("sys")

which should work as long as embedded python is available.

As a sanity check, can you try running

USER>:py

Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type quit() or Ctrl-D to exit this shell.
>>> import sys
>>> sys.__loader__
<class '_frozen_importlib.BuiltinImporter'>

@isc-shuliu
Copy link
Collaborator Author

@isc-tleavitt
After discussion with HSOPS, @isc-kiyer suggested 2 possibles solutions.

  1. Create a new StudioDocument class that represents the python wheel file (which is a zip under the hood) and attach it to the XML installer. Not sure how much work will be involved.

  2. Publish zpm as a tarball instead, and modify the existing one-liner installation command to use the tarball instead of XML. It's easier but may break some backward compatibility for users relying on the one-liner as part of the workflow.

Which way do you recommend?

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

Successfully merging a pull request may close this issue.

4 participants