2

When trying to install mod_wsgi using pip as follows:

pip install mod_wsgi

I get the following error:

4m.so -L/usr/local/lib -L/usr/local/lib/python3.4/config-3.4m -lpython3.4m /bin/ld: /usr/local/lib/libpython3.4m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libpython3.4m.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1

Command "/usr/local/virtualenvironment/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-dgfnrl36/mod-wsgi/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-m7uwmjt6/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/virtualenvironment/include/site/python3.4/mod-wsgi" failed with error code 1 in /tmp/pip-install-dgfnrl36/mod-wsgi/

I am using Python 3.4.3. I even tried to build mod_wsgi from source and pretty much get the same error.

From seeing this in the following in the stack trace perhaps its looking for python source or other source? I'm still fiddling around trying to figure out what it wants but any help will be appreciated.

4
  • I have a quite similar problem. The only difference is that I use python3.6 and I would like to add the corresponding mod_wsgi. I obtain the very same error messages. Jun 7, 2018 at 9:38
  • Hi @LajosSoukup , I actually managed to solve everything by building from source. Il add the answer here in a couple of hours, just need to re-vist my notes
    – Dean
    Jun 7, 2018 at 15:38
  • @LajosSoukup whats the output of pip -V
    – Dean
    Jun 7, 2018 at 16:16
  • Hi @De An: Thank you for the advice. After installing the python3.6-dev libraries I was also able to compile a new mod_wsgi from source and to install it. The key was to use the --with-python=/usr/bin/python3.6 parameter in the "configure" script. Jun 8, 2018 at 17:09

2 Answers 2

0

The solution that worked for me was to build mod_wsgi from source after installing the python dev libraries.

So

yum install python3-devel
  1. Download desired mod_wsgi version from http://modwsgi.readthedocs.io/en/develop/
  2. Unzip the source and cd into the unzipped source folder
  3. execute the following ./configure --with-python=/path/to/python/executable
  4. make
  5. make install
0

I prefer to install the module in my virtual environment. You got this error because you did not install your python with --enable-shared. Here is the link that talks about this issue https://groups.google.com/forum/#!topic/modwsgi/S9D2cTefj4k

and here is the link show you how to install python from source code as a shared library

https://danieleriksson.net/2017/02/08/how-to-install-latest-python-on-centos/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .