If you should ever encounter the following error when creating a Python virtual environment using the pyvenv command:
user$ pyvenv my_venv_dir
Error: Command '['/home/user/my_venv_dir/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1
... then the answer (below) provides a simple way to work around it, without resorting to setuptools and it's related acrobatics.
Here's an approach that is fairly O/S agnostic...
Both the
pyvenvandpythoncommands themselves include a--without-pipoption that enable you to work around this issue; without resorting tosetuptoolor other headaches. Taking note of myinline commentsbelow, here's how to do it, and is very easy to understand:I hope this helps. \(◠﹏◠)/