sparse-intern-71089
06/19/2020, 11:00 AMmicroscopic-pilot-97530
pulumi new, pulumi creates a lightweight virtual environment in a venv directory, runs venv\bin\pip install -r requirements.txt to install dependencies in the virtual environment, and sets the virtualenv: venv option in Pulumi.yaml which tells the CLI to use that virtual environment when subsequent commands (like pulumi up) are run. In prior versions, you’d have to do this manually and ensure you’d run pulumi up from an activated shell.
By default, a .gitignore file is generated for the project with an entry that excludes the venv/ dir from Git, so by default the venv dir won’t be included in any commits.
I’m guessing you’re seeing the error because you have virtualenv: venv set in Pulumi.yaml but no actual venv directory in the repo?
We should consider improving the Pulumi GitHub Action to take the new virtualenv option in Pulumi.yaml into account, creating the virtual environment (if it doesn’t exist) and installing dependencies into it automatically. I’ve opened https://github.com/pulumi/pulumi/issues/4871 to track this.
In the meantime, it’d probably be easiest to simply remove the virtualenv: venv option from Pulumi.yaml.
This does mean when developing the program locally on your machine you’ll need to manage a virtual environment yourself (if you don’t want to be installing dependencies globally on your machine). On macOS/Linux you can do this via: python3 -m venv venv, activate it by using source venv/bin/activate, and then install dependencies into it via pip install -r requirements.txt. Be sure to run pulumi preview or pulumi up from the activated shell.
Or use a tool like Pipenv to create/manage the virtual environment.