From 46ae829b33acd38c6c3ce5fb5873d042195dedc3 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 9 Aug 2018 08:54:24 +0100 Subject: [PATCH] Create virtualenv with '--never-download' For upgrades, and some new build configurations, trying to create a new venv results in the error: Could not get output from /usr/bin/virtualenv --help: Traceback (most recent call last): File "/usr/bin/virtualenv", line 6, in from pkg_resources import load_entry_point ImportError: No module named pkg_resources To work around this issue, we do the initial build of the venv using the CLI with the argument '--never-download' so that virtualenv just uses the versions of pip, setuptools and wheel that it already has. Change-Id: I639bc78d34b640a52c32fa175b12fa958518e999 --- tasks/repo_install.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasks/repo_install.yml b/tasks/repo_install.yml index 2359c06..bacc720 100644 --- a/tasks/repo_install.yml +++ b/tasks/repo_install.yml @@ -77,6 +77,11 @@ - "/usr/local/lib/python2.7/site-packages" register: _virtualenv_support +- name: Create the virtualenv (if it does not exist) + command: "virtualenv --never-download --no-site-packages {{ repo_pypiserver_bin | dirname }}" + args: + creates: "{{ repo_pypiserver_bin }}/activate" + # Note(odyssey4me): # To cater for a situation where the pip packages are changing, but the repo # does not yet have the package built, we need to ensure that this task can