I have a Raspberry pi 3 with Raspbian Stretch with desktop. What I need to do is install an Apache server and the WSGI module in order to run a flask app.

I could install Apache without issues: sudo apt-get install apache2

but as soon as I tried to install WSGI with sudo apt-get install libapache2-mod-wsgi I got the following error:

dpkg: error processing package libapache2-mod-wsgi (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I wanted to check if the package was there, so I typed dpkg -l libapache2-mod-wsgi and the package seemed to be there.

Doing apache2ctl -t -D DUMP_MODULES my package wasn't in the list.

I did some research and found that there is/was a known bug and the suggested fix was to go to /etc/apache2/mods-available/ and create a wsgi.conf file with this content:

LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

Following the instructions I found, you then should creat esome symbolic links:

cd  /etc/apache2/mods-enabled/ && ln -s ../mods-available/wsgi.load
cd /etc/apache2/mods-enabled/ && ln -s ../mods-available/wsgi.conf

restart Apache and it should work... but of course it did not.

Apache could not restart for some error and the only thing I could do was uninstall it, clean config files and restart.

Any idea?? Thank you for you suggestions!

  • Have you made a sudo apt update, sudo apt full-upgrade and sudo systemctl reboot?
    – Ingo
    Oct 4 '18 at 19:29

Thanks to @Ingo

sudo apt update
sudo apt full-upgrade
sudo systemctl reboot

this sequence seems to fix the problem I had with the wsgi module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.