Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual Environment Configuration not working #700

Open
charlespick opened this issue Aug 26, 2024 · 0 comments
Open

Virtual Environment Configuration not working #700

charlespick opened this issue Aug 26, 2024 · 0 comments

Comments

@charlespick
Copy link

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 2023.7.0
  • Ruby: 3.0.2p107
  • Distribution: Ubuntu 22.04
  • Module version: 7.3.0

The example at /examples/pyvenv.pp does not work. It gives the error Evaluation Error: Error while evaluating a Resource Statement, Class[Python]: parameter 'pip' expects a match for Python::Package::Ensure = Enum['absent', 'installed', 'latest', 'present'], got Boolean. It appears as if this needs to be updated to be absent.

However, I still cannot get this to work properly. After changing it to absent I get errors:

Applied catalog in   2.95 seconds
--
Dependency   Exec[python_virtualenv_/opt/ansible] has failures: true
Skipping because of failed dependencies
change from 'notrun' to ['0'] failed:   'python3.10 -m venv --clear     /opt/ansible && /opt/ansible/bin/pip --log   /opt/ansible/pip.log install --upgrade pip && /opt/ansible/bin/pip   --log /opt/ansible/pip.log install --upgrade setuptools' returned 1 instead   of one of [0] (corrective)
 
Failing command:   /opt/ansible/bin/python3.10
You may need to use sudo with that   command.  After installing the   python3-venv
package, recreate your virtual   environment.
'python3.10 -m venv --clear   /opt/ansible &&   /opt/ansible/bin/pip --log /opt/ansible/pip.log install --upgrade pip   && /opt/ansible/bin/pip --log /opt/ansible/pip.log install --upgrade   setuptools' returned 1 instead of one of [0]
 
 
apt install python3.10-venv
The virtual environment was not created   successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to   install the python3-venv
package using the following command.
Applying configuration version   'puppet01-development-3a54f1279d2'
Caching catalog for   orcastra01-dev.makerland.xyz
Catalog compiled by   puppet01.makerland.xyz
Requesting catalog from   puppet01.makerland.xyz:8140 (10.4.3.18)
Loading facts
Retrieving plugin
Retrieving pluginfacts
Using environment 'development'

ChatGPT tells me this is likely because the venv module is not installed. Indeed, it is not installed. Even when I set venv => 'present' on the Python class, it doesn't seem to realize automatically it needs to install venv first because the error is the same. I've tried require => Class['python'] but it won't find the reference.

Here is the code I used:

 class { 'python':
    pip     => 'absent',
    version => 'system',
  }

  python::pyvenv { '/opt/ansible':
  }

  python::pip { 'ansible':
    ensure     => 'latest',
    virtualenv => '/opt/ansible',
  }

Not sure what to try next. Any advice appreciated.
Charles

@voxpupuli voxpupuli deleted a comment Aug 26, 2024
@voxpupuli voxpupuli deleted a comment Aug 26, 2024
@kenyon kenyon changed the title Virtual Envrionment Configuration not working Virtual Environment Configuration not working Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@charlespick and others