puppet-python
puppet-python copied to clipboard
pyvenv is no longer compatible with Python built from source
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 5.56
- Ruby: 2.4.4
- Distribution: Ubuntu 16.04
- Module version: 4.0.0
How to reproduce (e.g Puppet code you use)
::python::pyvenv { $venv_path :
version => '3.7.6',
}
What are you seeing
The virtualenv is not created because it cannot install the python3.7-venv
package via apt
. This is because my version of python3.7
was built from source, and therefore I didn't get the python3.7
package via apt
. Since python3.7
is required to install python3.7-venv
via apt
, this fails.
When built from source, venv
is already included, so an additional package containing the venv
module is not necessary, so this step should be skipped.
What behaviour did you expect instead
I expected the virtualenv to be correctly created
Output log
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install python3.7-venv' returned 100:
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python3.7-venv
E: Couldn't find any package by glob 'python3.7-venv'
E: Couldn't find any package by regex 'python3.7-venv'
Any additional information you'd like to impart
I believe that the best way to skip this step if necessary would be to check for the presence of the venv
module. This could either be done using something like python3.7 -c "import venv"
or pydoc3.7 venv
, or checking if the folder exists at /usr/local/lib/python3.7/venv
(not sure if this directory changes).