func (c VenvConfig) Update(requirementsFile string) error {
	vCmd := VenvCommand{
		Config: c,
		Binary: "pip",
		Args:   []string{"install", "-r", requirementsFile},
	}
	_, _, err := vCmd.Run()
	if err != nil {
		return errors.Wrap(err, "unable to update virtualenv")
	}
	return nil
}
Update updates the virtualenv for the given config with the specified requirements file
package main
import (
	"bufio"
	"bytes"
	"context"
	"fmt"
	"io"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"time"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)
var (
	venvCommandTimeout = 2 * time.Hour  
)
type VenvConfig struct {
	Path   string  
	Python string  
}
func makeVenv(cfg VenvConfig) error {
	venvExecutable, err := exec.LookPath("virtualenv")
	if err != nil {
		return errors.Wrap(err, "virtualenv not found in path")
	}
	cmd := exec.Command(venvExecutable, "--python", cfg.Python, cfg.Path)
	err = cmd.Run()
	if err != nil {
		failedCommandLogger(cmd)
		return errors.Wrap(err, "unable to create virtual environment")
	}
	return nil
}
func (c VenvConfig) Ensure() error {
	_, err := os.Stat(c.Path)
	if os.IsNotExist(err) {
		err := makeVenv(c)
		if err != nil {
			return err
		}
	}
	return nil
}