Add Packages to the Package Management Environment
- POST /api/v1.2/package/<env ID>/add_packages
Use this API to add Python and R packages to a Package Management environment. A newly created environment supports the conda-forge channel which supports more packages. Viewing the List of Pre-installed Python and R Packages provides the list of pre-installed packages. Questions about Package Management provides answers to questions related to adding packages.
Note
In addition to the default Conda package repo, you can also add only R packages from the CRAN package repo. For more information, see Using the Default Package Management UI.
Required Role
The following users can make this API call:
Users who belong to the system-user or system-admin group.
Users who belong to a group associated with a role that allows updating an environment. See Managing Groups and Managing Roles for more information.
Parameters
Note
Parameters marked in bold are mandatory. Others are optional and have default values.
Parameter |
Description |
---|---|
source_type |
Only Python and R packages can be added. Specify |
package_names |
Specify the name of the package. If you just specify the name, the latest version of the
package gets installed. To install a specific version of the package, specify it in this
format: |
repo_url |
You must set this parameter to |
py_package_type |
Type of Python package. Possible values: Note This parameter is available by default for users of the new accounts. Users of the older accounts should contact Qubole Support to avail this parameter for faster installation of packages. |
Request API Syntax
curl -X POST -H "X-AUTH-TOKEN: <API-TOKEN>" -H "Content-Type: application/json" -H "Accept: application/json" \
-d ' {"source_type": "<package type>", "package_names": "<packagename1>,<packagename2>,....,<packagenameN>"}' \
"https://api.qubole.com/api/v1.2/package/<envID>/add_packages"
Note
The above syntax uses https://api.qubole.com as the endpoint. Qubole provides other endpoints to access QDS that are described in Supported Qubole Endpoints on Different Cloud Providers.
Sample API Requests
Note
If you upgrade or downgrade a Python package, the changed version is reflected only after you restart the Spark interpreter. Interpreter Operations lists the restart and other Spark interpreter operations.
The following sample API call shows how to add Python packages to an environment that has 100 as its ID.
curl -X POST -H "X-AUTH-TOKEN: <API-TOKEN>" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"source_type": "python_package", "package_names": "numpy,bipython==0.1,tensorflow"}' \
"https://api.qubole.com/api/v1.2/package/100/add_packages"
The following sample API call shows how to add R packages to an environment that has 100 as its ID.
curl -X POST -H "X-AUTH-TOKEN: <API-TOKEN>" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"source_type": "r_package", "package_names": "r-rserve,r-brew==1.0"}' \
"https://api.qubole.com/api/v1.2/package/100/add_packages"
The following sample API call shows how to add a R package from the CRAN package repo to an environment that has 100 as its ID.
curl -X POST -H "X-AUTH-TOKEN: <API-TOKEN>" -H "Content-Type: application/json" -H "Accept: application/json" \
-d '{"source_type": "r_package", "repo_packages": "[ {\"name\": \"RMySQL\", \"repo_url\": \"https://cran.r-project.org\"}]" }' \
"https://api.qubole.com/api/v1.2/package/100/add_packages"
The following sample API call shows how to add python packages from pip
to an environment that has 100 as its ID.
curl -X POST -H "X-AUTH-TOKEN: <API-TOKEN>" -H "Content-Type: application/json" -H "Accept: application/json" \
-d ' {"source_type": "python_package", "package_names": "numpy,scipy, plotly", "py_package_type": "pip"}' \
"https://api.qubole.com/api/v1.2/package/100/add_packages"