Skip to content

ModuleNotFoundError: No module named 'flask' on RHEL 8 #353

@bschonec

Description

@bschonec

After days of attempting to solve the problem myself I'm forced to realize that I don't have the skills to debug Python or Apache.

On a brand new RHEL8 system with @minimal installed, I am unable to get Puppetboard installed properly due to an error about the flask module not being found.

Using a simple:

class { 'puppetboard':
  manage_git        => true,       
  manage_virtualenv => true,
}

Apache barks with:

[Tue Mar 29 08:57:24.729351 2022] [wsgi:error] [pid 6074] [remote 1.17.1.5:58516] mod_wsgi (pid=6074): Failed to exec Python script file '/srv/puppetboard/puppetboard/wsgi.py'.
[Tue Mar 29 08:57:24.729453 2022] [wsgi:error] [pid 6074] [remote 1.17.1.5:58516] mod_wsgi (pid=6074): Exception occurred processing WSGI script '/srv/puppetboard/puppetboard/wsgi.py'.
[Tue Mar 29 08:57:24.729764 2022] [wsgi:error] [pid 6074] [remote 1.17.1.5:58516] Traceback (most recent call last):
[Tue Mar 29 08:57:24.729823 2022] [wsgi:error] [pid 6074] [remote 1.17.1.5:58516]   File "/srv/puppetboard/puppetboard/wsgi.py", line 14, in <module>
[Tue Mar 29 08:57:24.729831 2022] [wsgi:error] [pid 6074] [remote 1.17.1.5:58516]     from puppetboard.app import app as application
[Tue Mar 29 08:57:24.729840 2022] [wsgi:error] [pid 6074] [remote 1.17.1.5:58516]   File "/srv/puppetboard/puppetboard/puppetboard/app.py", line 7, in <module>
[Tue Mar 29 08:57:24.729845 2022] [wsgi:error] [pid 6074] [remote 1.17.1.5:58516]     from flask import render_template, Response
[Tue Mar 29 08:57:24.729863 2022] [wsgi:error] [pid 6074] [remote 1.17.1.5:58516] ModuleNotFoundError: No module named 'flask'

Now, Puppetboard does seem to install properly but it's the Python module (I hope I'm describing it properly) that's giving me trouble.

Apache is running, but I get the following from curl/browser:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

A manual run of the WSGI yeilds:

[root@rhel8gold ~]# python3.8 /srv/puppetboard/puppetboard/wsgi.py
Traceback (most recent call last):
  File "/srv/puppetboard/puppetboard/wsgi.py", line 14, in <module>
    from puppetboard.app import app as application
  File "/srv/puppetboard/puppetboard/puppetboard/app.py", line 7, in <module>
    from flask import render_template, Response
ModuleNotFoundError: No module named 'flask'

It's been about four years since I've implemented a Puppet environment so I'm a bit rusty. I've tried the recommendations here:

voxpupuli/puppetboard#527

and here:

voxpupuli/puppetboard#582

but to no avail.

I've had even less success with RHEL7.

SELinux is off and the local firewall allows incoming TCP/80.

Here's my apache vhost config:

<VirtualHost *:80>
  ServerName rhel8gold-puppetboard

  ## Vhost docroot
  DocumentRoot "/srv/puppetboard/puppetboard"

  ## Directories, there should at least be a declaration for /srv/puppetboard/puppetboard

  <Directory "/srv/puppetboard/puppetboard">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Require all granted
  </Directory>

  ## Logging
  ErrorLog "/var/log/httpd/rhel8gold-puppetboard_error.log"
  ServerSignature Off
  CustomLog "/var/log/httpd/rhel8gold-puppetboard_access.log" combined

  ## WSGI configuration
  WSGIDaemonProcess puppetboard group=puppetboard python-home=/srv/puppetboard/virtenv-puppetboard threads=5 user=puppetboard
  WSGIProcessGroup puppetboard
  WSGIScriptAlias / "/srv/puppetboard/puppetboard/wsgi.py"
</VirtualHost>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions