copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2024-09-09 |
watsonx.data, spark, analytics, provisioning |
watsonxdata |
{{site.data.keyword.attribute-definition-list}}
{: #combining-lib-sets1}
You can install a Python packages via pip or conda, as well as download a file as part of the library set by combining these options when you create the library set and prepare the JSON file tp pass in the REST API call.
You can use the combination option as shown in the following example:
{
"application_details": {
"application": "/opt/ibm/customization-scripts/customize_instance_app.py",
"arguments": ["{\"library_set\":{\"action\":\"add\",\"name\":\"multi_library\",\"libraries\":{\"pip\":{\"python\":{\"packages\":[\"numpy\"]}}},\"script\":{\"source\":\"py_files\",\"params\":[\"script_params\"]}}}"],
"py-files": "cos://<bucket>.dev-cos/jar/customization_script.py",
"conf": {
"spark.hadoop.fs.cos.dev-cos.endpoint":"https://s3.direct.us-south.cloud-object-storage.appdomain.cloud",
"spark.hadoop.fs.cos.dev-cos.access.key":"<cos_access_key>",
"spark.hadoop.fs.cos.dev-cos.secret.key":"<cos_secret_key>"
}
}
}
{: codeblock}
To increase readability, the unescaped JSON for the arguments would look as follows:
{
"library_set": {
"action": "add",
"name": "multi_library",
"libraries": {
"pip": {
"python": {
"packages": [
"numpy"
]
}
}
},
"script": {
"source": "py_files",
"params": [
"script_params"
]
}
}
}
{: codeblock}