How to install mod_wsgi after upgrading to python3.5 from python2.7

3,057 views
Skip to first unread message

BIJAL MANIAR

unread,
Sep 15, 2017, 5:04:02 AM9/15/17
to Django users

Hi,
I had a production application running with Python2.7 and Django1.11 through Apache and mod_wsgi.
Now I have upgraded to Python3.5 and created virtual env. pip install mod_wsgi is giving below error.

(p3_venv) bash-4.1# pip install mod_wsgi
Collecting mod_wsgi
  Downloading mod_wsgi-4.5.18.tar.gz (2.5MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-_hbwnbp5/mod-wsgi/setup.py", line 164, in <module>
        'missing Apache httpd server packages.' % APXS)
    RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.

Since mod_wsgi was already installed for Python2.7 how do I reinstall mod_wsgi. Do I need to re install within virtual environment or at system level. Any links/list of steps will be helpful.
Any help would be appreciated.

Thanks,
Bijal


Antonis Christofides

unread,
Sep 15, 2017, 5:27:23 AM9/15/17
to django...@googlegroups.com

RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.

Hi,

I've never faced this, but the error message is quite clear: in order for mod_wsgi to install itself you need to have the "apxs" command available. If you are using Debian or Ubuntu, it is in package "apache2-dev". So "apt install apache2-dev".

Regards,

Antonis

Antonis Christofides
http://djangodeployment.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/99d60e0c-293c-486d-9e9d-2332ca8723b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Schneider

unread,
Sep 15, 2017, 5:54:46 AM9/15/17
to django...@googlegroups.com


On Sep 15, 2017 2:04 AM, "BIJAL MANIAR" <bij...@gmail.com> wrote:

Hi,
I had a production application running with Python2.7 and Django1.11 through Apache and mod_wsgi.
Now I have upgraded to Python3.5 and created virtual env. pip install mod_wsgi is giving below error.

(p3_venv) bash-4.1# pip install mod_wsgi
Collecting mod_wsgi
  Downloading mod_wsgi-4.5.18.tar.gz (2.5MB)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-_hbwnbp5/mod-wsgi/setup.py", line 164, in <module>
        'missing Apache httpd server packages.' % APXS)
    RuntimeError: The 'apxs' command appears not to be installed or is not executable. Please check the list of prerequisites in the documentation for this package and install any missing Apache httpd server packages.

You're likely missing the development libraries needed to build Apache itself. Mod_wsgi needs to link with those during it's installation process.



Since mod_wsgi was already installed for Python2.7 how do I reinstall mod_wsgi. Do I need to re install within virtual environment or at system level. Any links/list of steps will be helpful.
Any help would be appreciated.

That is very dependent on your environment and how much control you want over the patch and update process. You'll need to remove the 2.7 version of mod_wsgi, or at the very least, prevent Apache from loading it. It cannot be loaded at the same time as another mod_wsgi instance using a different Python version.

You'll need to either use your system package manager to install the py3 version of mod_wsgi and hope that it matches your python version, or build it yourself (as you are trying to do) from a virtualenv that will run your project. Once that completes, you'll need to point Apache at the new module you've built. It's not necessarily trivial. Start with the official guide, or look for one specific to your OS:


-James

BIJAL MANIAR

unread,
Sep 15, 2017, 6:24:29 AM9/15/17
to Django users


Hi James,
Thanks for reply.

I read below commands to install for mod_wsgi from here - (https://modwsgi.readthedocs.io/en/develop/user-guides/quick-installation-guide.html)

tar xvfz mod_wsgi-X.Y.tar.gz
cd mod_wsgi-4.5.14
./configure  --with-apxs=/usr/sbin/apxs  --with-python=/usr/local/bin/python3
make
make install

Since I already had apache installed on Linux , I could locate apxs file
bash-4.1# locate apxs
/usr/local/apache2/bin/apxs

Can I install mod_wsgi at system level with this command for existing apache installation as an laternative to pip install mod_wsgi.
./configure  --with-apxs=/usr/local/apache2/bin/apxs  --with-python=/usr/local/bin/python3
Reply all
Reply to author
Forward
0 new messages