What is envd?
envd (ɪnˈvdɪ
) is a command-line tool that helps you create the container-based development environment for AI/ML.
Development environments are full of python and system dependencies, CUDA, BASH scripts, Dockerfiles, SSH configurations, Kubernetes YAMLs, and many other clunky things that are always breaking. envd is to solve the problem:
- Declare the list of dependencies (CUDA, python packages, your favorite IDE, and so on) in
build.envd
- Simply run
envd up
. - Develop in the isolated environment.
envd
?
Why use Environments built with envd
provide the following features out-of-the-box:
envd
build functions can be reused. Use include
function to import any git repositories. No more copy/paste Dockerfile instructions, let’s reuse them.
envdlib = include("https://github.com/tensorchord/envdlib") def build(): base(os="ubuntu20.04", language="python") envdlib.tensorboard(host_port=8888)
envdlib.tensorboard
is defined in github.com/tensorchord/envdlib
def tensorboard( envd_port=6006, envd_dir="/home/envd/logs", host_port=0, host_dir="/tmp", ): """Configure TensorBoard. Make sure you have permission for `host_dir` Args: envd_port (Optional[int]): port used by envd container envd_dir (Optional[str]): log storage mount path in the envd container host_port (Optional[int]): port used by the host, if not specified or equals to 0, envd will randomly choose a free port host_dir (Optional[str]): log storage mount path in the host """ install.python_packages(["tensorboard"]) runtime.mount(host_path=host_dir, envd_path=envd_dir) runtime.daemon( commands=[ [ "tensorboard", "--logdir", envd_dir, "--port", str(envd_port), "--host", "0.0.0.0", ], ] ) runtime.expose(envd_port=envd_port, host_port=host_port, service="tensorboard")
Buildkit supports parallel builds and software cache (e.g. pip index cache and apt cache). You can enjoy the benefits without knowledge of it.
For example, the PyPI cache is shared across builds and thus the package will be cached if it has been downloaded before.
Development environments are full of Dockerfiles, bash scripts, Kubernetes YAML manifests, and many other clunky files that are always breaking. You just need one configuration file build.envd
1, it works both for local Docker and Kubernetes clusters in the cloud.
SSH is configured for the created environment. You can use vscode-remote, jupyter, pycharm or other IDEs that you love. Besides this, declare the IDE extensions you want, let envd
take care of them.
def build(): install.vscode_extensions([ "ms-python.python", ])
Are you working on multiple projects, all of which need different versions of CUDA? envd
helps you create isolated and clean environments.
Who should use envd?
We’re focused on helping data scientists and teams that develop AI/ML models. And they may suffer from:
- building the development environments with Python/R/Julia, CUDA, Docker, SSH, and so on. Do you have a complicated Dockerfile or build script that sets up all your dev environments, but is always breaking?
- Updating the environment. Do you always need to ask infrastructure engineers how to add a new Python/R/Julia package in the Dockerfile?
- Managing environments and machines. Do you always forget which machines are used for the specific project, because you handle multiple projects concurrently?
Talk with us
🚀
Getting Started Requirements
- Docker (20.10.0 or above)
envd
Install and bootstrap envd
can be installed with pip
(only support Python3). After the installation, please run envd bootstrap
to bootstrap.
pip3 install --pre --upgrade envd envd bootstrap
You can add
--dockerhub-mirror
or-m
flag when runningenvd bootstrap
, to configure the mirror for docker.io registry:envd bootstrap --dockerhub-mirror https://docker.mirrors.sjtug.sjtu.edu.cn
envd
environment
Create an Please clone the envd-quick-start
:
git clone https://github.com/tensorchord/envd-quick-start.git
The build manifest build.envd
looks like:
def build(): base(os="ubuntu20.04", language="python3") # Configure the pip index if needed. # config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple") install.python_packages(name = [ "numpy", ]) shell("zsh")
Note that we use Python here as an example but please check out examples for other languages such as R and Julia here.
Then please run the command below to set up a new environment:
cd envd-quick-start && envd up