Skip to main content

Create Environment

cc.create_env

#

Sends the create request to the Covalent Cloud server with the environment dependency list.

Parameters

name (str)

Identifier/name for the software environment.

pip (Union[str, List[str]])

Python packages to be installed in the environment using pip. This value can be a string requirements.txt and/or a list of packages. Note, that if it's a list, it's possible that one of the values is the string requirements.txt. In case a requirements.txt is passed, it will be parsed into a list of packages and combined with the list of packages passed.

conda (Union[str, List[str], Dict[str, List[str]]])

List of packages to be installed in the environment using conda. This value can either be a list of packages, a filepath to environment.yml. It could also be a dictionary with channels and dependencies.

settings

Settings object with the dispatcher URI.

wait

If True, waits until the environment is ready before returning.

timeout

Timeout in seconds for the environment to be ready.

base_image

Base image of the runtime environment. If base_image is provided, it should be of the form <url>/<image>:<tag> (e.g. docker.io/python:3.9.6), where the :tag is optional and will default to latest if not specified. Only publicly accessible images are supported for now.

For example:

conda={
"channels": ["conda-forge", "defaults"],
"dependencies": ["numpy=1.21.*", "xarray=0.15.1"]
}

Whatever is passed, it will be parsed into a dictionary as shown above and sent as JSON to the Covalent Cloud server. If a list of packages is provided, they will be installed using the default conda channel.

Return Type

None

Returns

None

Examples

Create an environment with a list of packages:
 create_env("test-env", ["typing"], ["numpy=1.21.*", "xarray=0.15.1"])
Create an environment with a path to a conda 'environment.yml' file:
 create_env("test-env", conda="./environment.yml")
Create an environment with base image:
 create_env("test-env", pip="requirements.txt", base_image="docker.io/python:3.9.6")

Note

In case of a conflict of package between pip and conda, pip will take precedence and the conda one will be ignored.